Skip to content

Commit

Permalink
re #8791 fixed tick direction on 2D graphs
Browse files Browse the repository at this point in the history
  • Loading branch information
NickDraper committed Jan 31, 2014
1 parent b6fdc59 commit a6fdb90
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
21 changes: 19 additions & 2 deletions Code/Mantid/MantidPlot/src/ApplicationWindow.cpp
Expand Up @@ -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]);
Expand All @@ -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);
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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);

Expand All @@ -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<int> ticksList;
ticksList<<majTicksStyle<<Graph::Ticks::Out<<majTicksStyle<<majTicksStyle;
g->setMajorTicksType(ticksList);
ticksList.clear();
ticksList<<minTicksStyle<<Graph::Ticks::Out<<minTicksStyle<<minTicksStyle;
g->setMinorTicksType(ticksList);
}

ApplicationWindow* ApplicationWindow::importOPJ(const QString& filename, bool factorySettings, bool newProject)
{
if (filename.endsWith(".opj", Qt::CaseInsensitive) || filename.endsWith(".ogg", Qt::CaseInsensitive))
Expand Down
1 change: 1 addition & 0 deletions Code/Mantid/MantidPlot/src/ApplicationWindow.h
Expand Up @@ -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);
Expand Down
2 changes: 2 additions & 0 deletions Code/Mantid/MantidPlot/src/Mantid/MantidMatrix.cpp
Expand Up @@ -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);
Expand Down

0 comments on commit a6fdb90

Please sign in to comment.