Commit d491a135 authored by Christian Schneider's avatar Christian Schneider
Browse files

Added z_min and z_max for plotting

parent 6afd97a4
......@@ -231,7 +231,7 @@ class data_grid(data_module_base):
# Plotting #################################################################
def plot(self, name_x=None, name_y=None, cmap='magma', height=400,
width=800):
width=800, z_min=None, z_max=None):
"""Plot table with Holoviews
Parameters
......@@ -246,6 +246,11 @@ class data_grid(data_module_base):
Height of plot in pixels
width : int
Width of plot in pixels
x_min : None, float(Optional)
Minimum value for z values. If you set this, the scale will not
automatically updated to full contrast.
x_max : None, float (Optional)
Maximum value for z values
"""
if name_x is None:
x_vals = self.df.dims[0]
......@@ -259,7 +264,12 @@ class data_grid(data_module_base):
hv.opts({'QuadMesh': {'plot': {'width': width, 'height': height},
'style': {'cmap': cmap}}})
ds = hv.Dataset(self.df[self.x_min:self.x_max, self.y_min:self.y_max])
return hd.regrid(ds.to(hv.QuadMesh, [x_vals, y_vals]))
holo_object = hd.regrid(ds.to(hv.QuadMesh, [x_vals, y_vals]))
# Rescale
holo_object.redim.range(**{self.name_v:(z_min, z_max)})
return holo_object
def pcolormesh(self):
"""Simple color plot without options. Quick and light"""
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment