Logarithmic and linear scale on same axis
3 views (last 30 days)
Show older comments
Hi all,
I have a score than ranges from 1 to -inf. From 0 to 1 the score for various things varies linearly. However if the score is below 0 it can get quite large magnitudes. My aim is to be able to plot these scores such that the y axis varies linearly above 0 and logarithmically below 0. Can anyone help with this?
Thanks,
James
2 Comments
Cedric
on 10 Jun 2014
Edited: Cedric
on 10 Jun 2014
Here is a hint
Where would your representation of negative numbers connect with the representation of positive numbers? If you want/need a smooth transition between the two, they should connect at one point (0 according to your specification). This means that there must be a specific value of x at which you can pass from the blue curve to the red curve in a continuous fashion. Yet, if you look at the graph of what would be a trivial linear scale and a log base 10 scale, there is no such point.
Now you can try to find a transformation which which connects, but your scale wont be as simple as a linear increments of exponents of 10. Yet you can compute the location of exponents of 10, and place ticks and appropriate labels at these positions. But it is not direct and you would have to work a bit for that.
Answers (1)
John D'Errico
on 9 Jun 2014
It would be impossible to find a tool that would do this for you. And how many people want to do that anyway. That limits the potential to find a tool to do it.
HOWEVER, nothing stops you from doing it.
1. Transform your variable, so that it has the properties you want. Note that this is not a unique transformation, since each part of the linear/log transform will be scaled differently.
2. Plot
3. Set the ticks where you want them, labeled based on the transform you chose.
Not trivial, but not that difficult either.
0 Comments
See Also
Categories
Find more on 2-D and 3-D Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!