Skip to content

Commit bf5f6d7

Browse files
Fixed style for pytest
1 parent 2dcff13 commit bf5f6d7

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

cs_util/plots.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ def savefig(fname, close_fig=True):
5353

5454

5555
def dx(idx, nx=3, fx=1.025, log=True):
56-
"""Dx Plot.
56+
"""Dx.
57+
5758
Return small shift useful to diplace points along the the x-axis
5859
for a more readable plot.
5960
@@ -74,6 +75,7 @@ def dx(idx, nx=3, fx=1.025, log=True):
7475
else:
7576
return fx * (idx - (nx - 1) / 2)
7677

78+
7779
def plot_histograms(
7880
xs,
7981
labels,
@@ -261,15 +263,18 @@ def plot_data_1d(
261263
if linewidths is None:
262264
linewidths = [2] * len(x)
263265
if markers is None:
264-
markers = ['o'] * len(x)
266+
markers = ["o"] * len(x)
265267

266268
if create_figure:
267269
figure(figsize=(10, 10))
268270

269271
for idx in range(len(x)):
270272
this_x = x[idx]
271273
if shift_x:
272-
this_x *= dx(idx, len(x), log=xlog)
274+
if xlog:
275+
this_x *= dx(idx, len(x), log=xlog)
276+
else:
277+
raise ValueError("shift_x without log not implemented yet")
273278
if np.isnan(yerr[idx]).all():
274279
eb = plt.plot(
275280
this_x,
@@ -292,7 +297,7 @@ def plot_data_1d(
292297
)
293298
eb[-1][0].set_linestyle(eb_linestyles[idx])
294299

295-
plt.axhline(color="k", linestyle="dashed", linewidth=linewidths[0]/2)
300+
plt.axhline(color="k", linestyle="dashed", linewidth=linewidths[0] / 2)
296301

297302
if xlog:
298303
plt.xscale("log")

0 commit comments

Comments
 (0)