diff --git a/docs/source/release/v6.4.0/mantidworkbench.rst b/docs/source/release/v6.4.0/mantidworkbench.rst index 23e236d28595..6994bde22190 100644 --- a/docs/source/release/v6.4.0/mantidworkbench.rst +++ b/docs/source/release/v6.4.0/mantidworkbench.rst @@ -37,6 +37,7 @@ Bugfixes - Fixed a bug where trying to save a large project would cause Mantid to crash. - Workbench no longer generates an error when you save the ``Figure Options`` on a colour fill plot containing two images of different types (e.g. QuadMesh and Image). - Users are now prevented from overwriting previous versions of Mantid if the uninstaller is not present. Some antivirus software deletes the uninstaller. Installing over older versions without the uninstaller can cause Mantid not to function properly and for users to lose data. +- Removed Line Colour option from the toolbar in Contour Plots as it no longer works. Instrument Viewer ----------------- diff --git a/qt/applications/workbench/workbench/plotting/toolbar.py b/qt/applications/workbench/workbench/plotting/toolbar.py index 0f7a9ef5133c..7be55400c365 100644 --- a/qt/applications/workbench/workbench/plotting/toolbar.py +++ b/qt/applications/workbench/workbench/plotting/toolbar.py @@ -236,7 +236,8 @@ def set_buttons_visibility(self, fig): # For contour and wireframe plots, add a toolbar option to change the colour of the lines. if figure_type(fig) in [FigureType.Wireframe, FigureType.Contour]: - self.set_up_color_selector_toolbar_button(fig) + if any(isinstance(col, LineCollection) for col in fig.get_axes()[0].collections): + self.set_up_color_selector_toolbar_button(fig) if figure_type(fig) in [FigureType.Surface, FigureType.Wireframe, FigureType.Mesh]: self.adjust_for_3d_plots() diff --git a/qt/python/mantidqt/mantidqt/plotting/figuretype.py b/qt/python/mantidqt/mantidqt/plotting/figuretype.py index d069c6818faf..333ab04dcf74 100644 --- a/qt/python/mantidqt/mantidqt/plotting/figuretype.py +++ b/qt/python/mantidqt/mantidqt/plotting/figuretype.py @@ -13,7 +13,7 @@ # third party from enum import Enum from matplotlib.axes import Axes -from matplotlib.collections import LineCollection +from matplotlib.collections import LineCollection, PathCollection from matplotlib.container import ErrorbarContainer from mpl_toolkits.mplot3d.axes3d import Axes3D from mpl_toolkits.mplot3d.art3d import Line3DCollection, Poly3DCollection @@ -76,6 +76,8 @@ def axes_type(ax): elif len(ax.images) > 0 or len(ax.collections) > 0: if any(isinstance(col, LineCollection) for col in ax.collections): axtype = FigureType.Contour + elif any(isinstance(col, PathCollection) for col in ax.collections): + axtype = FigureType.Contour else: axtype = FigureType.Image diff --git a/qt/python/mantidqt/mantidqt/plotting/test/test_figuretype.py b/qt/python/mantidqt/mantidqt/plotting/test/test_figuretype.py index 2df124c00422..b1b1a957db13 100644 --- a/qt/python/mantidqt/mantidqt/plotting/test/test_figuretype.py +++ b/qt/python/mantidqt/mantidqt/plotting/test/test_figuretype.py @@ -10,7 +10,6 @@ from __future__ import absolute_import # std imports -from distutils.version import LooseVersion from unittest import TestCase, main # thirdparty imports @@ -64,10 +63,7 @@ def test_contour_plot_returns_contour(self): ax = plt.subplot(111) ax.imshow([[1], [1]]) ax.contour([[1, 1], [1, 1]]) - if LooseVersion("3.5") <= LooseVersion(matplotlib.__version__): - self.assertEqual(FigureType.Image, figure_type(ax.figure)) - else: - self.assertEqual(FigureType.Contour, figure_type(ax.figure)) + self.assertEqual(FigureType.Contour, figure_type(ax.figure)) def test_mesh_plot_returns_mesh(self): a = np.array([[[1, 1, 1], [2, 2, 2], [3, 3, 3]]])