Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* @mdolab/niceplots_maintainers
* @mdolab/niceplots_maintainers
9 changes: 3 additions & 6 deletions .github/workflows/niceplots.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,8 @@ on:
pull_request:

jobs:
black:
uses: mdolab/.github/.github/workflows/black.yaml@main

flake8:
uses: mdolab/.github/.github/workflows/flake8.yaml@main
format-and-lint:
uses: mdolab/.github/.github/workflows/format-and-lint.yaml@main

test:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -68,6 +65,6 @@ jobs:

# --- publish to PyPI
pypi:
needs: [test, flake8, black]
needs: [test, format-and-lint]
uses: mdolab/.github/.github/workflows/pypi.yaml@main
secrets: inherit
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
.pre-commit-config.yaml
ruff.toml

# Ignore any figures, except the reference images used for testing
*.pdf
*.png
Expand Down
2 changes: 1 addition & 1 deletion examples/testExamples.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ for f in *.py
do
echo "Testing $f"
python "$f"
done
done
2 changes: 1 addition & 1 deletion niceplots/fonts/OFL.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ with others.

The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
Expand Down
26 changes: 13 additions & 13 deletions niceplots/fonts/SIL Open Font License.txt
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
Copyright (C) Authors of original metafont fonts:
Donald Ervin Knuth (cm, concrete fonts)
1995, 1996, 1997 J"org Knappen, 1990, 1992 Norbert Schwarz (ec fonts)
1992-2006 A.Khodulev, O.Lapko, A.Berdnikov, V.Volovich (lh fonts)
1997-2005 Claudio Beccari (cb greek fonts)
2002 FUKUI Rei (tipa fonts)
2003-2005 Han The Thanh (Vietnamese fonts)
1996-2005 Walter Schmidt (cmbright fonts)
Copyright (C) 2003-2009, Andrey V. Panov ([email protected]),
with Reserved Font Family Name "Computer Modern Unicode fonts".
Copyright (C) Authors of original metafont fonts:
Donald Ervin Knuth (cm, concrete fonts)
1995, 1996, 1997 J"org Knappen, 1990, 1992 Norbert Schwarz (ec fonts)
1992-2006 A.Khodulev, O.Lapko, A.Berdnikov, V.Volovich (lh fonts)
1997-2005 Claudio Beccari (cb greek fonts)
2002 FUKUI Rei (tipa fonts)
2003-2005 Han The Thanh (Vietnamese fonts)
1996-2005 Walter Schmidt (cmbright fonts)

Copyright (C) 2003-2009, Andrey V. Panov ([email protected]),
with Reserved Font Family Name "Computer Modern Unicode fonts".



This Font Software is licensed under the SIL Open Font License, Version 1.1.
Expand Down Expand Up @@ -52,4 +52,4 @@ TERMINATION
This license becomes null and void if any of the above conditions are not met.

DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE.
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE.
17 changes: 8 additions & 9 deletions niceplots/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,8 @@ def handle_close(evt):

def adjust_spines(ax=None, spines=["left", "bottom"], outward=True):
"""Function to shift the axes/spines so they have that offset
Doumont look."""
Doumont look.
"""
if ax is None:
ax = plt.gca()

Expand Down Expand Up @@ -412,7 +413,7 @@ def horiz_bar(labels, times, header, nd=1, size=[5, 0.5], color=None):
t_max_digits = tm

# Actual loop that draws each bar
for j, (l, t, ax) in enumerate(zip(labels, times, axes)):
for j, (label, t, ax) in enumerate(zip(labels, times, axes)):
# Draw the gray line and singular yellow dot
ax.axhline(y=1, c=line_color, lw=3, zorder=0, alpha=0.5)
ax.scatter([t], [1], c=color, lw=0, s=100, zorder=1, clip_on=False)
Expand All @@ -435,7 +436,7 @@ def horiz_bar(labels, times, header, nd=1, size=[5, 0.5], color=None):
ax.spines["left"].set_visible(False)
ax.spines["right"].set_visible(False)
ax.spines["bottom"].set_visible(False)
ax.set_ylabel(l, rotation="horizontal", ha="right", va="center")
ax.set_ylabel(label, rotation="horizontal", ha="right", va="center")
string = "{number:.{digits}f}".format(number=t, digits=nd)
ax.annotate(
string,
Expand Down Expand Up @@ -482,7 +483,7 @@ def stacked_plots(
f, axarr = plt.subplots(n, figsize=figsize)

for i, (ylabel, ydata) in enumerate(data_dict.items()):
if type(ydata) == dict:
if isinstance(ydata, dict):
if "limits" in ydata.keys():
axarr[i].set_ylim(ydata["limits"])
elif "ticks" in ydata.keys():
Expand All @@ -497,7 +498,7 @@ def stacked_plots(

# Doesn't correctly work when we give a dict version
if xlim is not None:
if type(ydata) == dict:
if isinstance(ydata, dict):
ydata = ydata["data"]
ydata = np.array(ydata, dtype="float")
no_nan_y = ydata[np.isfinite(ydata)]
Expand All @@ -506,7 +507,7 @@ def stacked_plots(

for j, data_dict in enumerate(data_dict_list):
for i, (_, ydata) in enumerate(data_dict.items()):
if type(ydata) == dict:
if isinstance(ydata, dict):
ydata = ydata["data"]
axarr[i].plot(xdata, ydata, clip_on=False, lw=6 * line_scaler, color=colors[j])
if not lines_only:
Expand Down Expand Up @@ -624,9 +625,7 @@ def plot_opt_prob(

# --- Check if user has a recent enough version of matplotlib to use hashed boundaries ---
if conStyle.lower() == "hashed":
try:
patheffects.withTickedStroke
except AttributeError:
if not hasattr(patheffects, "withTickedStroke"):
warnings.warn(
"matplotlib >= 3.4 is required for hashed inequality constrain boundaries, switching to shaded inequality constraint style",
stacklevel=2,
Expand Down
Loading