Travis
Travis

Reputation: 2462

Can I display a QWT Plot's Z-axis interval on the left side?

I have a colored waterfall display implemented as a QwtPlot with a data container derived from QwtRasterData (m_SpectroPlot below). The values painted correspond to the Z-axis of the data, taken from a color map that is shown on the right side of the plot. The code looks like this:

const QwtInterval zInterval = m_SpectroPlot->data()->interval( Qt::ZAxis );
QwtScaleWidget *zAxis = axisWidget(QwtPlot::yRight);
zAxis->setColorBarEnabled(true);
zAxis->setColorMap( zInterval, new ColorMap());
setAxisScale(QwtPlot::yRight, zInterval.minValue(), zInterval.maxValue() );
setAxisAutoScale(QwtPlot::yRight);
enableAxis(QwtPlot::yRight);

Everything works fine, but I want to have the color map on the left side and hide the Y-axis values. When I replace yRight with yLeft in the above code, the displayed interval of the color map is locked to the interval of the data's Y-values. How can I maintain the current independent axis intervals while showing the color map on the yLeft axis?

In other words, I want to display the color map for the interval Z0-Z1 on the yLeft axis, while the actual Y-values drawn on the plot are Y0-Y1. It seems like I need to somehow tell the plot to use yRight instead of yLeft to scale the Y axis.

Upvotes: 0

Views: 705

Answers (1)

Travis
Travis

Reputation: 2462

After sifting through some documentation I found the answer. The data needs to be told to attach to the yRight axis instead of the default yLeft.

m_SpectroPlot->setYAxis(QwtPlot::yRight);

Upvotes: 2

Related Questions