Logarithmic scale problem
Hi,
I plot some values that range from 0~1024, and i want to use a logarithmic scale in y axis.
->setAxisScaleEngine(QwtPlot::yLeft, new QwtLogScaleEngine(10));
The problem is that values are drawn from the top and the scale take as maximum value 1e+20, while the minimum don't surpass 1.
i tried with ->setAxisScale(QwtPlot::yLeft,1, 100); and change with variable combinations the min, max values, but still the values are drawn from the top.
Iam using qwt 5.0.2
thanks in advance.
Re: Logarithmic scale problem
i think i've found a solution to my problem but it is temporary and not the appropriate. I understood tha there was a linear connection between the plotted values while the axis scale was logarithmic, i changed the line style from line to dots and it worked. however i 'd like to plot those values (0~1024) in log scale (1~1000) without converting them in logarithm and with the style of line. is that possible?
Re: Logarithmic scale problem
To set a logarithmic scale for 1-100
Code:
plot
->setAxisScaleEngine
(QwtPlot::yLeft,
new QwtLogScaleEngine
(10));
plot
->setAxisScale
(QwtPlot::yLeft,
1,
100);
plot->replot();
Uwe
Re: Logarithmic scale problem
Hi Uwe,
i have made it and i managed to draw the scale but my problem is that i want to plot the values as lines and not as dots, i was thinking to connect the dots with qwt marker but the connection is only horizontial or vertically! is there any solution to plot those values,in log scale, with line connection?
thanks.
Re: Logarithmic scale problem
The line style of a curve is completely unrelated to the fact, that you have a logarithmic scale.
Have a look at the bode example showing a logarithmic scale with curves in QwtPlotCurve::Lines style.
Uwe
1 Attachment(s)
Re: Logarithmic scale problem
Hi there, hi Uwe,
i think i have the same problem. I use QwtPlotMultiBarChart and QwtLogScaleEngine. But the bars are drawn from the top down to the correct values.
I stripped it to this:
Quote:
m_pPlot = new QwtPlot(this);
m_pPlot->setCanvasBackground(Qt::white);
m_pPlot->setAxisScaleEngine(QwtPlot::yLeft, new QwtLogScaleEngine());
m_pPlot->setAxisScale(QwtPlot::yLeft, 1, 500);
m_pPlot->resize(460,460);
m_pPlot->show();
QVector< QVector<double> >* allValues = new QVector< QVector<double> >();
for(int s=1; s<=3; s++)
{
QVector<double>* sampleValues = new QVector<double>;
sampleValues->append(10*s);
sampleValues->append(100*s);
allValues->append(*sampleValues);
}
QwtPlotMultiBarChart* multiBars = new QwtPlotMultiBarChart();
multiBars->setSamples(*allValues);
multiBars->attach(m_pPlot);
m_pPlot->replot();
Inside my Linix and on Windows the problem appears, looking like this:
Attachment 11978
On an embedded linux device from Garz & Fricke it's ok, it looks how it should look.
The Qwt files are compiled into the application file.
I tried qwt 6.1.0 and 6.1.3.
Re: Logarithmic scale problem
The bars are painted from the baseline of the item to the value. As the default setting for the baseline is 0 you have something invalid for a logarithmic scale.
Guess adding the following line is what you are looking for:
Code:
multiBars->setBaseline( 1.0 );
Uwe
Re: Logarithmic scale problem
Thats exactly what i need. Thank you.
Actually i am often confused with the assigned names for member, functions, etc. in Qwt, which i can't classify.
Re: Logarithmic scale problem
Quoting from http://qwt.sourceforge.net/class_qwt...f2880a4bf683ad: "The baseline is the origin for the chart. Each bar is painted from the baseline in the direction of the sample value."
What would you consider to be better than "baseline" - in this particular context ?
Uwe
Re: Logarithmic scale problem
improvement suggestion:
The default value for the baseline is 0 for linear scales.
The default value for the baseline is 1 for logarithmic scales.
That could be an improvement for Qwt.