Inversed logarithmic scale in gnuplot

大兔子大兔子 提交于 2020-01-05 08:27:07

问题


When plotting data which are very dense in small ranges of y, the logarithmic scale of gnuplot is the right scale to use.

But what scale to use when the opposite is the case? let's say most y values of different curves are between 90 and 100. In this case I want to use something like a inversed logarithmic scale. I tried a log scale between 0 and 1 but gnuplot wants me to choose a scale greater than 1

How can I achieve this?


回答1:


You are right, you can use the inverse of the logarithmic function, which is the exponential. But gnuplot only supports logarithmic scales, so you have to do the conversion on your own:

plot "myData" using 1:(exp($2))

You will also have to handle the axis tics on your own. Either you just set them via a list like

set ytics ("0" 1.00, "1" 2.72, "2" 7.39, "3" 20.09, "4" 54.60, "5" 148.41)

or you use the link feature for axes of gnuplot 5. The following code uses the y2axis (right y-axis) to plot the data and calculates the tics on the left y-axis from the right one.

set link y via log(x) inverse exp(x)
plot "myData" using 1:(exp($2)) axes x1y2

Side note: Always remember that a non-linear axis is hard to understand. Logarithmic scales are common, but everything else not. So, be careful when presenting the data



来源:https://stackoverflow.com/questions/29754945/inversed-logarithmic-scale-in-gnuplot

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!