Skip to content
Snippets Groups Projects
Commit dda982b3 authored by Conor Finn's avatar Conor Finn
Browse files

RE #28227 Correct colorbar when normalisation changes

The colour bar was reset to -0.1 and +0.1 when the normalistion was
changed. This reperforms the setting of the colour bar to the max and
min values in the workspace.
parent 0a00327b
No related branches found
No related tags found
No related merge requests found
......@@ -12,6 +12,7 @@ Defines interaction behaviour for plotting.
from __future__ import (absolute_import, unicode_literals)
# std imports
import numpy as np
from collections import OrderedDict
from copy import copy
from functools import partial
......@@ -704,6 +705,12 @@ class FigureInteraction(object):
if ax.lines: # Relim causes issues with colour plots, which have no lines.
ax.relim()
if ax.images: # Colour bar limits are wrong if workspace is ragged. Set them manually.
colorbar_min = np.nanmin(ax.images[-1].get_array())
colorbar_max = np.nanmax(ax.images[-1].get_array())
for image in ax.images:
image.set_clim(colorbar_min, colorbar_max)
ax.autoscale()
datafunctions.set_initial_dimensions(ax)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment