PDA

View Full Version : Qwt log scale for frequency



uz_qt
25th November 2013, 12:52
Hello,

I would like have x-axis of my Qwt plot in logarithmic scale. I have seen the bode example but was not able to implement it as desired. (I think some classes have been changed/renamed).
I would like to have the x-scale as shown in the attached plot1.jpg

So far, I have written the following lines:


QwtText XAxisLabel;
XAxisLabel.setText("Frequency [Hz]");
setAxisTitle(QwtPlot::xBottom, XAxisLabel);
setAxisScaleEngine(QwtPlot::xBottom, new QwtLogScaleEngine);


Please help me.

Added after 31 minutes:

Got it! :-)
Following is the solution:


QwtText XAxisLabel;
XAxisLabel.setText("Frequency [Hz]");
setAxisTitle(QwtPlot::xBottom, XAxisLabel);
setAxisMaxMajor(QwtPlot::xBottom, 6);
setAxisMaxMinor(QwtPlot::xBottom, 10);
setAxisScaleEngine(QwtPlot::xBottom, new QwtLogScaleEngine);
setAxisScale(QwtPlot::xBottom, 10.0, 5000.0);