Commit 4f477af8 authored by Tom Clayton's avatar Tom Clayton
Browse files

Code tidy up RE #30315

parent dc2297dd
......@@ -157,6 +157,10 @@ def _plot_impl(axes, workspace, args, kwargs):
kwargs['drawstyle'] = 'steps-post'
else:
normalize_by_bin_width, kwargs = get_normalize_by_bin_width(workspace, axes, **kwargs)
# the get... function returns kwargs without 'normalize_by_bin_width', but it is needed in _get_data_for_plot to
# avoid reverting to the default norm setting, in the event that this function is being called as part of a plot
# restoration
kwargs['normalize_by_bin_width'] = normalize_by_bin_width
x, y, _, _, indices, axis, kwargs = _get_data_for_plot(axes, workspace, kwargs)
if kwargs.pop('update_axes_labels', True):
_setLabels1D(axes,
......
......@@ -657,7 +657,7 @@ class MantidAxes(Axes):
with autoscale_on_update(self, autoscale_on):
artist = self.track_workspace_artist(workspace,
axesfunctions.plot(self, normalize_by_bin_width = is_normalized,
axesfunctions.plot(self, normalize_by_bin_width=is_normalized,
*args, **kwargs),
_data_update, spec_num, is_normalized,
MantidAxes.is_axis_of_type(MantidAxType.SPECTRUM, kwargs),
......
......@@ -289,7 +289,7 @@ def pcolormesh_on_axis(ax, ws, normalize_by_bin_width=None):
norm=scale(), normalize_by_bin_width=normalize_by_bin_width)
# remove normalize_by_bin_width from cargs if present so that this can be toggled in future
for cargs in pcm.axes.creation_args:
_ = cargs.pop('normalize_by_bin_width')
cargs.pop('normalize_by_bin_width')
else:
pcm = ax.pcolormesh(ws, cmap=ConfigService.getString("plots.images.Colormap"), norm=scale())
......
......@@ -74,7 +74,8 @@ class PlotsLoader(object):
self.workspace_plot_func(workspace, ax, ax.figure, cargs)
elif "function" in cargs:
self.plot_func(ax, cargs)
for cargs in creation_args_copy:
cargs.pop('normalize_by_bin_width', None)
ax.creation_args = creation_args_copy
# Update the fig
......@@ -122,11 +123,7 @@ class PlotsLoader(object):
func = function_dict[function_to_call]
# Plotting is done via an Axes object unless a colorbar needs to be added
if function_to_call in ["imshow", "pcolormesh"]:
if creation_arg['normalize_by_bin_width']:
is_norm = creation_arg.pop('normalize_by_bin_width')
func([workspace], fig, normalize_by_bin_width=is_norm)
else:
func([workspace], fig)
func([workspace], fig, normalize_by_bin_width=creation_arg['normalize_by_bin_width'])
self.color_bar_remade = True
else:
func(workspace, **creation_arg)
......
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