Skip to content

Commit 795bdaa

Browse files
committed
Added trailing commas
1 parent ebff476 commit 795bdaa

File tree

4 files changed

+51
-16
lines changed

4 files changed

+51
-16
lines changed

src/maxplotlib/backends/matplotlib/utils_old.py

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,12 @@ def setup_plotstyle(
299299

300300
def set_common_xlabel(self, xlabel="common X"):
301301
self.fig.text(
302-
0.5, -0.075, xlabel, va="center", ha="center", fontsize=self.fontsize
302+
0.5,
303+
-0.075,
304+
xlabel,
305+
va="center",
306+
ha="center",
307+
fontsize=self.fontsize,
303308
)
304309
# fig.text(0.04, 0.5, 'common Y', va='center', ha='center', rotation='vertical', fontsize=rcParams['axes.labelsize'])
305310

@@ -438,7 +443,9 @@ def scale_axis(
438443
i0 = int(xmin / delta)
439444
i1 = int(xmax / delta + 1)
440445
locs = np.arange(
441-
includepoint - width, includepoint + width + delta, delta
446+
includepoint - width,
447+
includepoint + width + delta,
448+
delta,
442449
)
443450
locs = locs[locs >= xmin - 1e-12]
444451
locs = locs[locs <= xmax + 1e-12]
@@ -473,7 +480,9 @@ def scale_axis(
473480
i0 = int(ymin / delta)
474481
i1 = int(ymax / delta + 1)
475482
locs = np.arange(
476-
includepoint - width, includepoint + width + delta, delta
483+
includepoint - width,
484+
includepoint + width + delta,
485+
delta,
477486
)
478487
locs = locs[locs >= ymin - 1e-12]
479488
locs = locs[locs <= ymax + 1e-12]
@@ -507,7 +516,10 @@ def adjustFigAspect(self, aspect=1):
507516
else:
508517
ylim /= aspect
509518
self.fig.subplots_adjust(
510-
left=0.5 - xlim, right=0.5 + xlim, bottom=0.5 - ylim, top=0.5 + ylim
519+
left=0.5 - xlim,
520+
right=0.5 + xlim,
521+
bottom=0.5 - ylim,
522+
top=0.5 + ylim,
511523
)
512524

513525
def add_figure_label(
@@ -619,14 +631,16 @@ def savefig(
619631
# self.fig.savefig(self.directory + filename + '.' + format,bbox_inches='tight', transparent=False)
620632
if tight_layout:
621633
self.fig.savefig(
622-
self.directory + filename + "." + format, bbox_inches="tight"
634+
self.directory + filename + "." + format,
635+
bbox_inches="tight",
623636
)
624637
else:
625638
self.fig.savefig(self.directory + filename + "." + format)
626639
elif format == "pgf":
627640
# Save pgf figure
628641
self.fig.savefig(
629-
self.directory + filename + "." + format, bbox_inches="tight"
642+
self.directory + filename + "." + format,
643+
bbox_inches="tight",
630644
)
631645

632646
# Replace pgf figure colors with colorlet
@@ -672,15 +686,16 @@ def savefig(
672686
else:
673687
try:
674688
plt.savefig(
675-
self.directory + filename + "." + format, bbox_inches="tight"
689+
self.directory + filename + "." + format,
690+
bbox_inches="tight",
676691
)
677692
except Exception as e:
678693
print(
679694
"ERROR: Could not save figure: "
680695
+ self.directory
681696
+ filename
682697
+ "."
683-
+ format
698+
+ format,
684699
)
685700
print(e)
686701

@@ -690,7 +705,7 @@ def savefig(
690705
for format in formats:
691706
if format in imgcat_formats:
692707
f.write(
693-
"imgcat " + self.directory + filename + "." + format + "\n"
708+
"imgcat " + self.directory + filename + "." + format + "\n",
694709
)
695710

696711
if print_imgcat and ("png" in formats or "pdf" in formats):

src/maxplotlib/canvas/canvas.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,10 @@ def savefig(
209209
for layer in self.layers:
210210
layers.append(layer)
211211
fig, axs = self.plot(
212-
show=False, backend="matplotlib", savefig=True, layers=layers
212+
show=False,
213+
backend="matplotlib",
214+
savefig=True,
215+
layers=layers,
213216
)
214217
_fn = f"{filename_no_extension}_{layers}.{extension}"
215218
fig.savefig(_fn)
@@ -226,7 +229,10 @@ def savefig(
226229
else:
227230

228231
fig, axs = self.plot(
229-
show=False, backend="matplotlib", savefig=True, layers=layers
232+
show=False,
233+
backend="matplotlib",
234+
savefig=True,
235+
layers=layers,
230236
)
231237
fig.savefig(full_filepath)
232238
if verbose:
@@ -317,7 +323,8 @@ def plot_plotly(self, show=True, savefig=None, usetex=False):
317323
fig_width, fig_height = self._figsize
318324
else:
319325
fig_width, fig_height = plt_utils.set_size(
320-
width=self._width, ratio=self._ratio
326+
width=self._width,
327+
ratio=self._ratio,
321328
)
322329
# print(self._width, fig_width, fig_height)
323330
# Create subplots

src/maxplotlib/subfigure/line_plot.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,13 @@ def __init__(self, x, y, label="", content="", layer=0, **kwargs):
1919

2020
class Path:
2121
def __init__(
22-
self, nodes, path_actions=[], cycle=False, label="", layer=0, **kwargs
22+
self,
23+
nodes,
24+
path_actions=[],
25+
cycle=False,
26+
label="",
27+
layer=0,
28+
**kwargs,
2329
):
2430
self.nodes = nodes
2531
self.path_actions = path_actions
@@ -235,7 +241,8 @@ def plot_plotly(self):
235241
line=dict(
236242
color=line["kwargs"].get("color", None),
237243
dash=linestyle_map.get(
238-
line["kwargs"].get("linestyle", "solid"), "solid"
244+
line["kwargs"].get("linestyle", "solid"),
245+
"solid",
239246
),
240247
),
241248
)

src/maxplotlib/subfigure/tikz_figure.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,13 @@ def to_tikz(self):
8484

8585
class Path:
8686
def __init__(
87-
self, nodes, path_actions=[], cycle=False, label="", layer=0, **kwargs
87+
self,
88+
nodes,
89+
path_actions=[],
90+
cycle=False,
91+
label="",
92+
layer=0,
93+
**kwargs,
8894
):
8995
"""
9096
Represents a path (line) connecting multiple nodes.
@@ -388,7 +394,7 @@ def plot_matplotlib(self, ax, layers=None):
388394
line_width = float(match.group(1))
389395
else:
390396
print(
391-
f"Invalid line width specification: '{line_width_spec}', defaulting to 1"
397+
f"Invalid line width specification: '{line_width_spec}', defaulting to 1",
392398
)
393399
line_width = 1
394400
else:

0 commit comments

Comments
 (0)