From 5a978e7d32e8ace1d5114a8600d9993d950b09cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nico=20Schl=C3=B6mer?= Date: Fri, 16 Jul 2021 16:34:05 +0200 Subject: [PATCH 1/4] increase distance from legend labels to lines --- src/dufte/main.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/dufte/main.py b/src/dufte/main.py index f4c81ca..4651536 100644 --- a/src/dufte/main.py +++ b/src/dufte/main.py @@ -175,7 +175,10 @@ def legend(ax=None, min_label_distance="auto", alpha: float = 1.0): xlim0, xlim1 = ax.get_xlim() for label, t, color in zip(labels, targets, colors): plt.text( - xlim1 + (xlim1 - xlim0) / 100, + # Leave the labels some space to breathe. If they are too close to the + # lines, they can get visually merged. + # + xlim1 + (xlim1 - xlim0) / 100 * 3, t, label, verticalalignment="center", From 3469f63ee913227e5b8a7e73397bbe265379e7b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nico=20Schl=C3=B6mer?= Date: Fri, 16 Jul 2021 16:34:23 +0200 Subject: [PATCH 2/4] more readme --- README.md | 1 + setup.cfg | 1 + tests/test_plot.py | 4 ++-- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 88d9a08..d01febf 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,7 @@

[![PyPi Version](https://img.shields.io/pypi/v/dufte.svg?style=flat-square)](https://pypi.org/project/dufte) +[![Anaconda Cloud](https://anaconda.org/conda-forge/dufte/badges/version.svg?=style=flat-square)](https://anaconda.org/conda-forge/dufte/) [![PyPI pyversions](https://img.shields.io/pypi/pyversions/dufte.svg?style=flat-square)](https://pypi.org/pypi/dufte/) [![GitHub stars](https://img.shields.io/github/stars/nschloe/dufte.svg?logo=github&label=Stars&logoColor=white&style=flat-square)](https://github.com/nschloe/dufte) [![PyPi downloads](https://img.shields.io/pypi/dm/dufte.svg?style=flat-square)](https://pypistats.org/packages/dufte) diff --git a/setup.cfg b/setup.cfg index 820aada..ef98eb6 100644 --- a/setup.cfg +++ b/setup.cfg @@ -14,6 +14,7 @@ long_description_content_type = text/markdown license = GPL-3.0-or-later classifiers = Development Status :: 4 - Beta + Framework :: Matplotlib License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+) Operating System :: OS Independent Programming Language :: Python diff --git a/tests/test_plot.py b/tests/test_plot.py index 6542c86..91f7ffc 100644 --- a/tests/test_plot.py +++ b/tests/test_plot.py @@ -20,8 +20,8 @@ def test_plot(filename, light: bool, noise, offsets): y0 += noise * np.random.rand(len(y0)) plt.plot(x0, y0, label=label) - plt.xlabel("x label") - plt.ylabel("y label") + plt.xlabel("distance [m]") + dufte.ylabel("voltage [V]") # plt.title("title") dufte.legend() From 02295f356c18c61a329f5b93a23a7e7187422ce7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nico=20Schl=C3=B6mer?= Date: Fri, 16 Jul 2021 16:34:29 +0200 Subject: [PATCH 3/4] version bump --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index ef98eb6..d9752a2 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = dufte -version = 0.2.20 +version = 0.2.21 author = Nico Schlömer author_email = nico.schloemer@gmail.com description = Clean matplotlib plots From 97cb88e4d8dcee918497f590d1408df590c22224 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nico=20Schl=C3=B6mer?= Date: Fri, 16 Jul 2021 16:36:48 +0200 Subject: [PATCH 4/4] add pre-commit config --- .github/workflows/ci.yml | 18 ++++++------------ .pre-commit-config.yaml | 16 ++++++++++++++++ 2 files changed, 22 insertions(+), 12 deletions(-) create mode 100644 .pre-commit-config.yaml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 60fc0c4..cda10ba 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,18 +12,12 @@ jobs: lint: runs-on: ubuntu-latest steps: - - uses: actions/setup-python@v2 - with: - python-version: "3.x" - - uses: actions/checkout@v2 - - name: Lint with flake8 - run: | - pip install flake8 - flake8 . - - name: Lint with black - run: | - pip install black - black --check . + - name: Check out repo + uses: actions/checkout@v2 + - name: Set up Python + uses: actions/setup-python@v2 + - name: Run pre-commit + uses: pre-commit/action@v2.0.3 build: runs-on: ubuntu-latest diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..ddcbfd7 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,16 @@ +repos: + - repo: https://github.com/PyCQA/isort + rev: 5.9.1 + hooks: + - id: isort + + - repo: https://github.com/python/black + rev: 21.6b0 + hooks: + - id: black + language_version: python3 + + - repo: https://gitlab.com/pycqa/flake8 + rev: 3.9.2 + hooks: + - id: flake8