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
1 change: 0 additions & 1 deletion scripts/adjustements.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import matplotlib as mpl
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
from matplotlib.collections import PatchCollection


ROOT_DIR = pathlib.Path(__file__).parent.parent
Expand Down
2 changes: 1 addition & 1 deletion scripts/anatomy.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
def minor_tick(x, pos):
if not x % 1.0:
return ""
return "%.2f" % x
return f"{x:.2f}"


ax.xaxis.set_major_locator(MultipleLocator(1.000))
Expand Down
2 changes: 0 additions & 2 deletions scripts/annotate.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
# -----------------------------------------------------------------------------
import pathlib

import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt


Expand Down
4 changes: 2 additions & 2 deletions scripts/colors.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
'raw' : ['b', 'g', 'r', 'c', 'm', 'y', 'k', 'w'],
'rgba' : [(1, 0, 0), (1, 0, 0, 0.75), (1, 0, 0, 0.50), (1, 0, 0, 0.25)],
'HexRGBA' : ["#FF0000", "#FF0000BB", "#FF000088", "#FF000044"],
'cycle' : ["C%d" % i for i in range(10)],
'grey' : ["%1.1f" % (i/10) for i in range(11)],
'cycle' : [f"C{i}" for i in range(10)],
'grey' : [f"{i/10:1.1f}" for i in range(11)],
'name' : ["DarkRed", "Firebrick", "Crimson", "IndianRed", "Salmon" ] }

for name, colors in palettes.items():
Expand Down
1 change: 0 additions & 1 deletion scripts/legend.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
# -----------------------------------------------------------------------------
import pathlib

import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt

Expand Down
6 changes: 2 additions & 4 deletions scripts/linestyles.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@ def split(n_segment):
for x0, x1, style in zip(X0, X1, styles):
ax.plot([x0, x1], [y, y], color="C1", linestyle=style,
solid_capstyle="round", dash_capstyle="round", linewidth=3)
if isinstance(style, str): text = '"%s"' % style
else: text = '%s' % str(style)
text = text.replace(' ', '')
text = f'{style!r}'.replace(' ', '')
ax.text((x0+x1)/2, y-0.2, text,
size=8, ha="center", va="top", family="Source Code Pro")
ax.text(X0[0]-0.25, y+0.2, "linestyle or ls", family="Source Code Pro",
Expand All @@ -51,7 +49,7 @@ def split(n_segment):
linewidth=7, linestyle="--", alpha=.25)
ax.plot([x0, x1], [y, y], color="C1", linewidth=7,
linestyle="--", dash_capstyle=style)
ax.text((x0+x1)/2, y-0.2, '"%s"' % style, family="Source Code Pro",
ax.text((x0+x1)/2, y-0.2, f'{style!r}', family="Source Code Pro",
size=10, ha="center", va="top")
ax.text(X0[0]-0.25, y+0.2, "capstyle or dash_capstyle", family="Source Code Pro",
size=14, ha="left", va="baseline")
Expand Down
9 changes: 3 additions & 6 deletions scripts/markers.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,10 @@
"1", "2", "3", "4", "+", "x", "|", "_", 4, 5, 6, 7,
".", "o", "s", "P", "X", "*", "p", "D", "<", ">", "^", "v", ]
for x, y, marker in zip(X, Y, markers):
if y == 3: fc = "white"
else: fc = "C1"
fc = "white" if y == 3 else "C1"
plt.scatter(x, 1+y, s=100, marker=marker, fc=fc, ec="C1", lw=0.5)

if y == 1: marker = "\$%s\$" % marker
if isinstance(marker, str): text = "'%s'" % marker
else: text = '%s' % marker
text = f"{marker!r}".replace("$", r"\$")
plt.text(x, 1+y-0.4, text,
size="x-small", ha="center", va="top", family="Monospace")

Expand All @@ -50,7 +47,7 @@
Y = y*np.ones(len(X))
ax.plot(X, Y, linewidth=1, color="black",
marker=".", mfc="white", mec="black", mew="1", markevery=mark)
ax.text((X[0]+X[-1])/2, y-0.2, '%s' % str(mark),
ax.text((X[0]+X[-1])/2, y-0.2, str(mark),
size="x-small", ha="center", va="top")

plt.text(.7, 1, "markevery",
Expand Down
8 changes: 4 additions & 4 deletions scripts/plot-variations.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,13 @@
ax1.plot(X, Y1, color="C1", linewidth=0.75)
ax1.set_ylim(0, 4), ax1.set_yticks(np.arange(1, 4))
ax1.grid()
ax1.tick_params(axis=u'both', which=u'both', length=0)
ax1.tick_params(axis='both', which='both', length=0)

Y2 = 2+1*np.cos(2*X)
ax2.plot(X, Y2, color="C0", linewidth=0.75)
ax2.set_ylim(0, 4), ax2.set_yticks(np.arange(1, 4))
ax2.grid()
ax2.tick_params(axis=u'both', which=u'both', length=0)
ax2.tick_params(axis='both', which='both', length=0)
fig.savefig(ROOT_DIR / "figures/plot-vsplit.pdf")

# Basic line plot (hsplit)
Expand All @@ -99,13 +99,13 @@
ax1.plot(Y1, X, color="C1", linewidth=0.75)
ax1.set_xlim(0, 4), ax1.set_xticks(np.arange(1, 4))
ax1.grid()
ax1.tick_params(axis=u'both', which=u'both', length=0)
ax1.tick_params(axis='both', which='both', length=0)

Y2 = 2+1*np.cos(2*X)
ax2.plot(Y2, X, color="C0", linewidth=0.75)
ax2.set_xlim(0, 4), ax2.set_xticks(np.arange(1, 4))
ax2.grid()
ax2.tick_params(axis=u'both', which=u'both', length=0)
ax2.tick_params(axis='both', which='both', length=0)
fig.savefig(ROOT_DIR / "figures/plot-hsplit.pdf")

# Basic line plot (title)
Expand Down
1 change: 0 additions & 1 deletion scripts/styles.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import pathlib

import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt


Expand Down
1 change: 0 additions & 1 deletion scripts/tick-multiple-locator.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
# ----------------------------------------------------------------------------
import pathlib

import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
import matplotlib.ticker as ticker
Expand Down
1 change: 0 additions & 1 deletion scripts/tip-colorbar.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
import matplotlib.patheffects as path_effects


ROOT_DIR = pathlib.Path(__file__).parent.parent
Expand Down
2 changes: 0 additions & 2 deletions scripts/tip-dotted.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
# Scripts to generate all the basic plots
import pathlib

import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt


Expand Down
1 change: 0 additions & 1 deletion scripts/tip-font-family.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
# ----------------------------------------------------------------------------
import pathlib

import numpy as np
import matplotlib.pyplot as plt
import matplotlib.ticker as ticker

Expand Down
Loading