Hello,
I'd like to plot a spectrogram with fixed aspect ratio (1:1) and have zooming/unzooming feature. I added the following code to the spectrogram example:
QwtPlotRescaler *d_rescaler = new QwtPlotRescaler(canvas());
d_rescaler->setRescalePolicy(QwtPlotRescaler::Fitting);
d_rescaler
->setReferenceAxis
(QwtPlot::xBottom);
d_rescaler
->setAspectRatio
(QwtPlot::yLeft,
1.0);
d_rescaler
->setAspectRatio
(QwtPlot::yRight,
0.0);
d_rescaler
->setAspectRatio
(QwtPlot::xTop,
0.0);
d_rescaler->setExpandingDirection(QwtPlotRescaler::ExpandBoth);
d_rescaler->setIntervalHint(Qt::XAxis, d_spectrogram->data()->interval( Qt::XAxis ));
d_rescaler->setIntervalHint(Qt::YAxis, d_spectrogram->data()->interval( Qt::YAxis ));
QwtPlotRescaler *d_rescaler = new QwtPlotRescaler(canvas());
d_rescaler->setRescalePolicy(QwtPlotRescaler::Fitting);
d_rescaler->setReferenceAxis(QwtPlot::xBottom);
d_rescaler->setAspectRatio(QwtPlot::yLeft, 1.0);
d_rescaler->setAspectRatio(QwtPlot::yRight, 0.0);
d_rescaler->setAspectRatio(QwtPlot::xTop, 0.0);
d_rescaler->setExpandingDirection(QwtPlotRescaler::ExpandBoth);
d_rescaler->setIntervalHint(Qt::XAxis, d_spectrogram->data()->interval( Qt::XAxis ));
d_rescaler->setIntervalHint(Qt::YAxis, d_spectrogram->data()->interval( Qt::YAxis ));
To copy to clipboard, switch view to plain text mode
When I zoom in selecting a rectangular region the original aspect ratio (1:1)
is not preserved. Also when I resize the window the zoom is not preserved, it gets
unzoomed to original size.
What is the proper way of having a zoom and fixed aspect ratio using spectrogram?
Thanks,
Dusan
Bookmarks