Changing data in spectogram
Hi!
I'm trying to modify spectogram example to plot interpolated function z(x,y) based on 2D array Z and 1D arrays X and Y. I made interpolation algorithm and function
Code:
double value(double x, double y)
, but i have a problem to implement those arrays.
I tried with pointers to arrays in SpectrogramData, but I cant get it work.
What's the easiest way to provide those arrays to value function?
Second step is to change values of arrays and replot...
Thanks!
P.S.
Re: Changing data in spectogram
Quote:
Originally Posted by
stefan
What's the easiest way to provide those arrays to value function?
Use QwtMatrixRasterData ( it implements next next neighbour and bilinear interpolation ).
Quote:
Originally Posted by
stefan
Second step is to change values of arrays and replot...
The spectrogram caches the rendered image, that needs to be invalidated before you replot. The spectrogram class implicitely invalidates this image, when you use its public API. When you want to change the array behind the back of the class you have to call spectrogram->invalidateCache() manually.
Uwe
Re: Changing data in spectogram
Quote:
Originally Posted by
Uwe
The spectrogram class implicitely invalidates this image, when you use its public API. When you want to change the array behind the back of the class you have to call spectrogram->invalidateCache() manually.
Uwe
Thanks a lot for that note. This should be written in big letters somewhere in the documentation of spectrogram.
Re: Changing data in spectogram
Re: Changing data in spectogram
Hi,
I have another issue regarding spectogram example, thus I'll continue on this post.
When I change intervals
Code:
setInterval( Qt::XAxis, QwtInterval( -1.5, 1.56 ) );
The plot is actually drawn from -1.5 to 2.0
It probably rounds limits.. But I dont want that.
How can I prevent that? How can I crop a plot? I dont mind if the last value on the axis is 1.5
Thank you
Re: Changing data in spectogram
To avoid, that tick labels close to the borders extend the canvas you have to set:
Code:
plot->plotLayout()->setAlignCanvasToScales(true);
Next you have to decide if you want to use auto scaling or not. If not you can assign the axes scales manually.
Code:
plot
->setAxisScale
( QwtPlot::xBottom, ...
);
plot
->setAxisScale
( QwtPlot::yLeft, ...
);
...
If you want to have autoscaling, but you want to exclude your spectrogram from participating:
Code:
spectrogram
->setItemAtribute
( QwtPlotItem::AutoScale,
false );
Or if you want to have autoscaling for your spectrogram , but you don't want the autoscaler to align the borders of the scales:
Code:
plot
->axisScaleEngine
( QwtPlot::xBottom )->setAttribute
(plot
->axisScaleEngine
( QwtPlot::yLeft )->setAttribute
(...
HTH,
Uwe
Re: Changing data in spectogram
Yes, that's exactly what I'm looking for!
Code:
plotLayout()->setAlignCanvasToScales(true);
setAxisScale
( QwtPlot::xBottom,X
->first
(),X
->last
());
setAxisScale
( QwtPlot::yLeft,Y
->first
(),Y
->last
());
setAxisScale
(QwtPlot::yRight,zMin,zMax
);
Uwe, you are a true QwtMaster :) Thanks!
Re: Changing data in spectogram
No, obviously you want autoscaling. Then this is your code ( of course with the same result ):
Code:
plotLayout()->setAlignCanvasToScales(true);
axisScaleEngine
( QwtPlot::xBottom )->setAttribute
(axisScaleEngine
( QwtPlot::yLeft )->setAttribute
( zMin, zMax), d_spectrogram->colorMap());
setAxisScale
(QwtPlot::yRight, zMin, zMax
);
Uwe
Re: Changing data in spectogram
Hi.
Following on this topic. I'm trying to use the spectrogram to plot and visualize some elevation data...
I've only the intensity values (height of the mountains) at certain points in the x,y coordinates. Total about 20 heights.
How do I input the raster data so that I could see the spectrogram being interpolated inbetween the mountain heights?
The entire area map is about 400x400 in length and width.
Thank you for any advise.
Re: Changing data in spectogram
Quote:
Originally Posted by
marc2050
Following on this topic.
This question doesn't follow - please start a new thread for a unrelated posting,
Uwe
Re: Changing data in spectogram
This doesn't work for me :(
Re: Changing data in spectogram
Quote:
Originally Posted by
dzemomona12
This doesn't work for me :(
You failed with starting a new thread for unrelated postings ?
Uwe