Skip to content

Commit

Permalink
Merge pull request #34097 from mantidproject/34080_change_contour_too…
Browse files Browse the repository at this point in the history
…lbar

Disabled script and color line options for contour plots
  • Loading branch information
gemmaguest authored Jun 15, 2022
2 parents cacabba + e89e8af commit b39958b
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
1 change: 1 addition & 0 deletions docs/source/release/v6.4.0/mantidworkbench.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
-----------------
Expand Down
3 changes: 2 additions & 1 deletion qt/applications/workbench/workbench/plotting/toolbar.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
4 changes: 3 additions & 1 deletion qt/python/mantidqt/mantidqt/plotting/figuretype.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down
6 changes: 1 addition & 5 deletions qt/python/mantidqt/mantidqt/plotting/test/test_figuretype.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
from __future__ import absolute_import

# std imports
from distutils.version import LooseVersion
from unittest import TestCase, main

# thirdparty imports
Expand Down Expand Up @@ -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]]])
Expand Down

0 comments on commit b39958b

Please sign in to comment.