## Log Scale

Help
2009-09-02
2014-10-02
• Rémy Claverie - 2009-09-02

Hi everybody,

It could be nice to change the linear scale of the axes for non linear as Logarithmic.
Is it difficult to implement ?

Thanks a lot

Rémy

• cdron77 - 2009-09-15

Hi,

logarithmic scales is one of the things in the wishlist from long time ago, but the urgency to implement them never raised enough :-)

To implement such feature is not really hard, but neither trivial: it is a question to add two switches in the mpWindow selecting between linear and log scale both on x and y, and then (this is the boring part), to change the Plot functions consequently for each mpLayer derived class.

CD-RON77

• Rémy Claverie - 2009-09-15

Hi Davide,

Thanks for your answer. I will have a look  how to implement it. But not soon, I am too busy

Rémy

• Marco DeFreitas - 2010-09-30

I too have a need for log scale. Any hope it might be in the next release? Thanks!

• CodeXtrordinaire - 2010-12-22

I have gotten log plots by transforming the data and coordinate(s) to log space.  Then the scale is just linear in the log space.

For instance, if you wanted to plot y = x^2 on a log-log plot, the points you would plot are given by  ( log(x), log(x^2) ), instead of (x,x^2).  The plot boundaries would also have to be defined in log units, so if your axis was from 1 to 100, it would now be from 0 to 2.

Of course your axes won't have the traditional graduated tick marks as is common for log plots, but depending on your application might not matter.  p2x() and p2y() would of course return the log values, so to convert back to the original data units you must do x = 10^p2x(), or whatever base your logarithm is.  The shape of the curve though will be exactly the same.

• Byron - 2014-10-02

You can always take the log10() of your data and plot the result; however, this will not make the axis labels (tick labels) logarithmic. This function will return the text you will need for axis tick labels. Presently, you will need to hide the linear scale and draw these labels uniformly across the axis instead: