PDA

View Full Version : How to transpose xAxis and yAxis for QwtPlotSpectrogram?



Marco7
20th May 2011, 10:27
Hi everybody,

is there a way to transpose the xAxis and the yAxis (e.g. xAxis pointing up, yAxis pointing to right) in a QwtPlotSpectrogram.

The reason why I don't simply change the data is that I want to make a fast animation of a large matrix and with
setValueMatrix(QVector.mid(0,i*n_cols),n_cols) I can very efficiently extract a sub-matrix but then the animation is row-wise instead of column-wise.

Thanks a lot
Marco

Uwe
23rd May 2011, 06:33
Maybe deriving from QwtRasterData makes more sense than using QwtMatrixRasterData in your situation.

But if you want to use QwtMatrixRasterData you can simply:


YourRasterData: public QwtMatrixRasterData
{
public:
....

virtual double value( double x, double y ) const
{
return QwtMatrixRasterData::value( y, x );
}
};
Uwe

Marco7
23rd May 2011, 09:01
Hi Uwe,

Thanks a lot. Your solution worked fine.

By the way I'm really impressed by the speed of qwt. I used vtk before which is good for 3D graphics but for 2D qwt is much better.

Best regards,
Marco