Commit 4d7b499f authored by amichaut's avatar amichaut
Browse files

bug fix: map plotting supports vlim different from None

parent 7214292c
......@@ -981,11 +981,17 @@ def plot_all_scalar_fields(data_dir, df, data, field, image={'image_fn': None, '
# get vlim
map_param_ = dict(map_param)
vlim_default = tca.compute_vlim(df, data, field)
if map_param_['vlim'] is None:
vlim = tca.compute_vlim(df, data, field)
map_param_['vlim'] = vlim
map_param_['vlim'] = vlim_default
else:
for i,vl in enumerate(map_param_['vlim']):
if vl is None:
map_param_['vlim'][i] = vlim_default[i]
label = tpr.make_param_label(field, l_unit=info['length_unit'], t_unit=info['time_unit'])
plot_cmap(plot_dir, label, map_param_['cmap'], vlim[0], vlim[1])
plot_cmap(plot_dir, label, map_param_['cmap'], map_param_['vlim'][0], map_param_['vlim'][1])
for frame in df['frame'].unique():
frame = int(frame)
......@@ -1011,11 +1017,16 @@ def plot_all_vector_fields(data_dir, df, data, field, plot_on_field=None, dim=3,
# get vlim
if plot_on_field is not None:
vlim_default = tca.compute_vlim(df, data, plot_on_field['plot_on'])
if plot_on_field['vlim'] is None:
vlim = tca.compute_vlim(df, data, plot_on_field['plot_on'])
plot_on_field['vlim'] = vlim
label = tpr.make_param_label(plot_on_field['plot_on'], l_unit=info['length_unit'], t_unit=info['time_unit'])
plot_cmap(plot_dir, label, plot_on_field['cmap'], vlim[0], vlim[1])
plot_on_field['vlim'] = vlim_default
else:
for i,vl in enumerate(plot_on_field['vlim']):
if vl is None:
plot_on_field['vlim'][i] = vlim_default[i]
label = tpr.make_param_label(plot_on_field['plot_on'], l_unit=info['length_unit'], t_unit=info['time_unit'])
plot_cmap(plot_dir, label, plot_on_field['cmap'], plot_on_field['vlim'][0], plot_on_field['vlim'][1])
for frame in df['frame'].unique():
frame = int(frame)
......@@ -1056,12 +1067,16 @@ def plot_all_Voronoi(data_dir, df, data, show_local_area=True, df_mean = None,
# get vlim
if show_local_area:
if 'area' in df.columns:
vlim_default = [df['area'].min(), df['area'].max()]
if map_param['vlim'] is None:
vlim = [df['area'].min(), df['area'].max()]
if vlim == [np.nan, np.nan]:
if vlim_default == [np.nan, np.nan]:
show_local_area = False
else:
map_param['vlim'] = vlim
map_param['vlim'] = vlim_default
else:
for i,vl in enumerate(map_param['vlim']):
if vl is None:
map_param['vlim'][i] = vlim_default[i]
else:
show_local_area = False
......
Supports Markdown
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