Andrea Angeletti
Andrea Angeletti

Reputation: 299

What the 'set logscale' does in gnuplot?

My question is more about math then the actual code. When use the command

set logscale

on gnuplot 5.0 what is happening ? It should represents the logarithmic values values of the x and y points. But it doesn not seems to work properly. For example on my data I have x and y values smaller then 1 so I am expecting to see negative values for these values on the plot, but I see only postivie values. What I am doing wrong ?

Upvotes: 3

Views: 3691

Answers (2)

user8153
user8153

Reputation: 4095

A specific example might help to illustrate the effect of logarithmic scaling:

set xrange [0.1:10]
plot x**2

enter image description here

Let's plot this again, but this time on a logarithmic scale. Watch how the scaling of the x and y axes changes:

set logscale
replot

enter image description here

Upvotes: 2

choroba
choroba

Reputation: 241768

The logarithmic scale still shows the real values around the axes, just their distances are logarithmic. To really see the negative values, you need to really apply the log function:

plot "file.dat" using (log($1)):(log($2)) with lines

without setting the logscale.

Upvotes: 1

Related Questions