[plotter] add possibility to change scale in plot kwargs

This commit is contained in:
Noe Brucy
2021-01-12 17:03:51 +01:00
parent 581c936f3f
commit 167e9103ee
+9 -2
View File
@@ -958,6 +958,8 @@ class Plotter(Aggregator, BaseProcessor):
yunit=None, yunit=None,
xunit_coeff=1.0, xunit_coeff=1.0,
yunit_coeff=1.0, yunit_coeff=1.0,
xscale="linear",
yscale="linear",
fit=None, fit=None,
fitlabel=None, fitlabel=None,
smooth=0, smooth=0,
@@ -988,7 +990,7 @@ class Plotter(Aggregator, BaseProcessor):
node_x = self.save.get_node(name_x) node_x = self.save.get_node(name_x)
node_y = self.save.get_node(name_y) node_y = self.save.get_node(name_y)
# If the actual data is in a,other file, fetch it # If the actual data is in another file, fetch it
if subname_x: if subname_x:
hdf5_x = tables.open_file(node_x.read()) hdf5_x = tables.open_file(node_x.read())
node_x = hdf5_x.get_node(subname_x) node_x = hdf5_x.get_node(subname_x)
@@ -1052,7 +1054,8 @@ class Plotter(Aggregator, BaseProcessor):
yerr_max[mask], yerr_max[mask],
) )
else: else:
x, y = node_x[run], node_y[run] x = node_x[run].read() * xunit_old.express(xunit)
y = node_y[run].read() * yunit_old.express(yunit)
mask = np.isfinite(x) & np.isfinite(y) mask = np.isfinite(x) & np.isfinite(y)
x, y = x[mask], y[mask] x, y = x[mask], y[mask]
@@ -1099,6 +1102,10 @@ class Plotter(Aggregator, BaseProcessor):
if legend: if legend:
plt.legend() plt.legend()
# Ax scale
plt.xscale(xscale)
plt.yscale(yscale)
if fit is not None: if fit is not None:
self._overlay_fit( self._overlay_fit(
x, x,