Logarithmic and linear scale on same axis

3 次查看(过去 30 天)
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 个评论
Cedric
Cedric 2014-6-10
编辑:Cedric 2014-6-10
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.

请先登录,再进行评论。

回答(1 个)

John D'Errico
John D'Errico 2014-6-9
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.

类别

Help CenterFile Exchange 中查找有关 2-D and 3-D Plots 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by