Skip to content
Snippets Groups Projects
Unverified Commit 60a3f91f authored by Gigg, Martyn Anthony's avatar Gigg, Martyn Anthony Committed by GitHub
Browse files

Merge pull request #28170 from mantidproject/28142_instrument_view_colorbar_tick_marks

Fix colorbar ticks not appearing in instrument view
parents 7543f7c8 477da7b1
No related branches found
No related tags found
No related merge requests found
......@@ -112,5 +112,6 @@ Bugfixes
- Fixed a crash in the TOFConverter interface when leaving input fields blank or using invalid characters.
- Fixed bug that caused an error if a MDHistoWorkspace was plotted and a user attempted to open a context menu.
- Fixed a bug which caused graphic scaling issues when the double-click menu was used to set an axis as log-scaled.
- Fixed a bug where the colorbar in the instrument view would sometimes have no markers if the scale was set to SymmetricLog10.
:ref:`Release 5.0.0 <v5.0.0>`
......@@ -5,12 +5,14 @@
// & Institut Laue - Langevin
// SPDX - License - Identifier: GPL - 3.0 +
#include "MantidQtWidgets/MplCpp/Colors.h"
#include "MantidPythonInterface/core/Converters/ToPyList.h"
#include "MantidPythonInterface/core/ErrorHandling.h"
#include "MantidPythonInterface/core/GlobalInterpreterLock.h"
#include <boost/optional.hpp>
#include <algorithm>
#include <numeric>
#include <tuple>
using boost::none;
......@@ -20,6 +22,7 @@ using Mantid::PythonInterface::PythonException;
using OptionalTupleDouble = optional<std::tuple<double, double>>;
using namespace Mantid::PythonInterface;
using namespace MantidQt::Widgets::Common;
namespace MantidQt {
......@@ -176,8 +179,16 @@ Python::Object SymLogNorm::tickLocator() const {
// Create log transform with base=10
auto transform = scaleModule().attr("SymmetricalLogTransform")(
10, Python::Object(pyobj().attr("linthresh")), m_linscale);
// Sets the subs parameter to be [1,2,...,10]. The parameter determines where
// the ticks on the colorbar are placed and setting it to this ensures that
// any range of values will have ticks.
std::vector<float> subsVector(10);
std::iota(subsVector.begin(), subsVector.end(), 1.f);
auto subs = Converters::ToPyList<float>()(subsVector);
return Python::Object(
tickerModule().attr("SymmetricalLogLocator")(transform));
tickerModule().attr("SymmetricalLogLocator")(transform, subs));
}
/**
......@@ -186,7 +197,7 @@ Python::Object SymLogNorm::tickLocator() const {
*/
Python::Object SymLogNorm::labelFormatter() const {
GlobalInterpreterLock lock;
return Python::Object(tickerModule().attr("LogFormatterMathtext")());
return Python::Object(tickerModule().attr("LogFormatterSciNotation")());
}
// ------------------------ PowerNorm ------------------------------------------
......
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