Skip to content

Commit 8a81c65

Browse files
committed
Formatting
1 parent 07763c3 commit 8a81c65

File tree

5 files changed

+26
-13
lines changed

5 files changed

+26
-13
lines changed

src/maxplotlib/backends/matplotlib/utils_old.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ def __init__(self, hex_color):
3131
self.pgf_col_str += self.rgb_dec_str[2] + "}%"
3232

3333
def invert(self):
34-
3534
inverted_color = Color(self.hx)
3635

3736
def define_color_str(self, name):
@@ -261,7 +260,8 @@ def create_lineplot(self):
261260
self.ny_subplots,
262261
self.nx_subplots,
263262
figsize=self.set_size(
264-
self.width, ratio=self.ratio #
263+
self.width,
264+
ratio=self.ratio, #
265265
), # sharex=True,#sharex='all', sharey='all',
266266
dpi=self.dpi,
267267
constrained_layout=False,
@@ -280,7 +280,6 @@ def setup_plotstyle(
280280
grid_alpha=0.0,
281281
grid_linestyle="dotted",
282282
):
283-
284283
if tex_fonts:
285284
plt.rcParams.update(self.tex_fonts)
286285

@@ -405,7 +404,6 @@ def scale_axis(
405404
nticks=5,
406405
locs_labels=None,
407406
):
408-
409407
# https://matplotlib.org/3.1.1/api/_as_gen/matplotlib.pyplot.xticks.html
410408
# if subfigure_x == -1 and subfigure_y == -1 and nx_subplots > 1 and ny_subplots > 1:
411409
# print('enter subfigure_x and subfigure_y!')
@@ -596,7 +594,6 @@ def savefig(
596594

597595
if format_folder:
598596
for format in formats:
599-
600597
# print('self.directory',self.directory)
601598
Path(self.directory + "/" + format).mkdir(parents=True, exist_ok=True)
602599

@@ -764,7 +761,6 @@ def dump(
764761
self,
765762
filename="",
766763
):
767-
768764
if filename == "":
769765
filename = self.filename + "_dump.txt"
770766
Path(self.directory + "/dump").mkdir(parents=True, exist_ok=True)

src/maxplotlib/canvas/canvas.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ def layers(self):
4444
for (row, col), subplot in self.subplots.items():
4545
layers.extend(subplot.layers)
4646
return list(set(layers))
47+
4748
def generate_new_rowcol(self, row, col):
4849
if row is None:
4950
for irow in range(self.nrows):
@@ -115,21 +116,32 @@ def add_subplot(self, **kwargs):
115116
self.subplots[label] = line_plot
116117
return line_plot
117118

118-
def savefig(self, filename, extension='pdf', backend="matplotlib", layers = None, layer_by_layer=False):
119+
def savefig(
120+
self,
121+
filename,
122+
extension="pdf",
123+
backend="matplotlib",
124+
layers=None,
125+
layer_by_layer=False,
126+
):
119127
if backend == "matplotlib":
120128
if layer_by_layer:
121129
layers = []
122130
for layer in self.layers:
123131
layers.append(layer)
124-
fig, axs = self.plot(show=False, backend="matplotlib", savefig=True, layers=layers)
132+
fig, axs = self.plot(
133+
show=False, backend="matplotlib", savefig=True, layers=layers
134+
)
125135
fig.savefig(f"{filename}_{layers}.{extension}")
126136
else:
127137
if layers is None:
128138
layers = self.layers
129139
full_filepath = f"{filename}.{extension}"
130140
else:
131141
full_filepath = f"{filename}_{layers}.{extension}"
132-
fig, axs = self.plot(show=False, backend="matplotlib", savefig=True, layers=layers)
142+
fig, axs = self.plot(
143+
show=False, backend="matplotlib", savefig=True, layers=layers
144+
)
133145
fig.savefig(full_filepath)
134146

135147
# def add_line(self, label, x_data, y_data, **kwargs):

src/maxplotlib/subfigure/line_plot.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def __init__(self, **kwargs):
3939
def add_caption(self, caption):
4040
self._caption = caption
4141

42-
def add_line(self, x_data, y_data, layer = 0, **kwargs):
42+
def add_line(self, x_data, y_data, layer=0, **kwargs):
4343
"""
4444
Add a line to the plot.
4545
@@ -49,7 +49,12 @@ def add_line(self, x_data, y_data, layer = 0, **kwargs):
4949
y_data (list): Y-axis data.
5050
**kwargs: Additional keyword arguments for the plot (e.g., color, linestyle).
5151
"""
52-
ld = {"x": np.array(x_data), "y": np.array(y_data), "layer": layer, "kwargs": kwargs}
52+
ld = {
53+
"x": np.array(x_data),
54+
"y": np.array(y_data),
55+
"layer": layer,
56+
"kwargs": kwargs,
57+
}
5358
self.line_data.append(ld)
5459
if layer in self.layered_line_data:
5560
self.layered_line_data[layer].append(ld)
@@ -62,6 +67,7 @@ def layers(self):
6267
for layer_name, layer_lines in self.layered_line_data.items():
6368
layers.append(layer_name)
6469
return layers
70+
6571
def plot_matplotlib(self, ax, layers=None):
6672
"""
6773
Plot all lines on the provided axis.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
class Subfigure:
22
def __init__(self, **kwargs):
3-
self.kwargs = kwargs
3+
self.kwargs = kwargs

src/maxplotlib/tests/test_imports.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
@pytest.mark.parametrize("x", [0])
55
def import_modules(x):
66
import matplotlib
7-
87
import maxplotlib
98

109

0 commit comments

Comments
 (0)