From a6fdb90081775e6b37df5c8950271307d50bc69d Mon Sep 17 00:00:00 2001 From: Nick Draper Date: Fri, 31 Jan 2014 09:47:34 +0000 Subject: [PATCH] re #8791 fixed tick direction on 2D graphs --- .../MantidPlot/src/ApplicationWindow.cpp | 21 +++++++++++++++++-- .../Mantid/MantidPlot/src/ApplicationWindow.h | 1 + .../MantidPlot/src/Mantid/MantidMatrix.cpp | 2 ++ 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/Code/Mantid/MantidPlot/src/ApplicationWindow.cpp b/Code/Mantid/MantidPlot/src/ApplicationWindow.cpp index c34b64777424..f3c6db1193e4 100644 --- a/Code/Mantid/MantidPlot/src/ApplicationWindow.cpp +++ b/Code/Mantid/MantidPlot/src/ApplicationWindow.cpp @@ -2956,6 +2956,9 @@ void ApplicationWindow::setPreferences(Graph* g) g->setAxisTitle(i, tr(" ")); } } + + + //set the scale type i.e. log or linear g->setScale(QwtPlot::yLeft, d_axes_scales[0]); g->setScale(QwtPlot::yRight, d_axes_scales[1]); @@ -2980,6 +2983,7 @@ void ApplicationWindow::setPreferences(Graph* g) for (int i = 0; i < QwtPlot::axisCnt; i++) g->setAxisTitleDistance(i, d_graph_axes_labels_dist); // need to call the plot functions for log/linear, errorbars and distribution stuff + } g->setSynchronizedScaleDivisions(d_synchronize_graph_scales); @@ -5131,9 +5135,10 @@ void ApplicationWindow::readSettings() // Transform from the old setting for plot defaults, will only happen once. if ( !settings.contains("/UpdateForPlotImprovements1") ) - { - settings.beginGroup("/General"); + { settings.writeEntry("/UpdateForPlotImprovements1","true"); + settings.beginGroup("/General"); + settings.writeEntry("/Antialiasing","true"); //enable right and top axes without labels @@ -14190,6 +14195,7 @@ MultiLayer* ApplicationWindow::plotSpectrogram(Matrix *m, Graph::CurveType type) MultiLayer* g = multilayerPlot(generateUniqueName(tr("Graph"))); Graph* plot = g->activeGraph(); setPreferences(plot); + setSpectrogramTickStyle(plot); plot->plotSpectrogram(m, type); @@ -14199,6 +14205,17 @@ MultiLayer* ApplicationWindow::plotSpectrogram(Matrix *m, Graph::CurveType type) return g; } +void ApplicationWindow::setSpectrogramTickStyle(Graph* g) +{ + //always use the out tick style for colour bar axes + QList ticksList; + ticksList<setMajorTicksType(ticksList); + ticksList.clear(); + ticksList<setMinorTicksType(ticksList); +} + ApplicationWindow* ApplicationWindow::importOPJ(const QString& filename, bool factorySettings, bool newProject) { if (filename.endsWith(".opj", Qt::CaseInsensitive) || filename.endsWith(".ogg", Qt::CaseInsensitive)) diff --git a/Code/Mantid/MantidPlot/src/ApplicationWindow.h b/Code/Mantid/MantidPlot/src/ApplicationWindow.h index e5788d50109d..b75d21ff1e1a 100644 --- a/Code/Mantid/MantidPlot/src/ApplicationWindow.h +++ b/Code/Mantid/MantidPlot/src/ApplicationWindow.h @@ -461,6 +461,7 @@ public slots: //! \name Graphs //@{ void setPreferences(Graph* g); + void setSpectrogramTickStyle(Graph* g); void setGraphDefaultSettings(bool autoscale,bool scaleFonts,bool resizeLayers,bool antialiasing, bool fixedAspectRatio); void setLegendDefaultSettings(int frame, const QFont& font, const QColor& textCol, const QColor& backgroundCol); diff --git a/Code/Mantid/MantidPlot/src/Mantid/MantidMatrix.cpp b/Code/Mantid/MantidPlot/src/Mantid/MantidMatrix.cpp index d60a56acb8ba..acbac8e9c04b 100644 --- a/Code/Mantid/MantidPlot/src/Mantid/MantidMatrix.cpp +++ b/Code/Mantid/MantidPlot/src/Mantid/MantidMatrix.cpp @@ -692,6 +692,8 @@ MultiLayer* MantidMatrix::plotGraph2D(Graph::CurveType type) Spectrogram* MantidMatrix::plotSpectrogram(Graph* plot, ApplicationWindow* app, Graph::CurveType type,bool project,const ProjectData* const prjData) { app->setPreferences(plot); + app->setSpectrogramTickStyle(plot); + plot->setTitle(tr("Workspace ") + name()); const Mantid::API::Axis* ax; ax = m_workspace->getAxis(0);