wxPlotCtrl or wxMathPlot - Logarithmic axis

Talk here about issues with one of the components hosted at wxCode, or suggest features for it.
Post Reply
DJahn
In need of some credit
In need of some credit
Posts: 1
Joined: Wed Sep 26, 2012 2:01 pm

wxPlotCtrl or wxMathPlot - Logarithmic axis

Post by DJahn »

Hello everyone,

I want to use wxPlotCtrl or wxMathPlot to plot some scientific graphs, for example bode plots.
To do this properly it is necessary to have logarithmic scaled axis, but as far as i can see there is no way to realise this!?

Does anyone have an idea how to implement this in wxPlotCtrl or wxMathPlot?

Thank you
Greetings
Byron123
In need of some credit
In need of some credit
Posts: 9
Joined: Wed Mar 21, 2012 6:03 pm

Re: wxPlotCtrl or wxMathPlot - Logarithmic axis

Post by Byron123 »

You can always plot (x, log10 (y)), but then the units of y will be log10 (y). You can get the correct labels using double a = log10 (Ymax / Ymin) / N; where you want N intervals between the ticks. The values to write will then be Ymin * pow (10.0, a*n) for the nth tick. n=0 gives Ymin and n=N gives Ymax. To use this, however, you will need to hide the y-axis and to draw the tick text yourself.
Post Reply