What is xscale and yscale?

Viewed 7717

I am reading some code, therein I noticed a big change while using pyplot.xaxis('log') and pyplot.yaxis('log'). So the basic scatter plot looks like this: enter image description here

and after adding:

plt.xscale('log')
plt.yscale('log')

the graph looks like this: enter image description here

I went to look the documentation but there was not enough explanation about it. like, What is xscale and yscale and what is the function of their respective parameters like log, linear, symlog and logit?

enter image description here

I am absolutely new in graph and matplotlib. I have no good knowledge of these, can you please help me out with this and explain what is xscale, yscale and what is the function of their respective parameters like log, linear, symlog and logit?

Thank you for help

1 Answers

You are setting the scale of your y and x-axis to be logarithmic in scale.

Normally every y distance on your axis your values increment by a fixed amount, example:

   0 at 0cm
   1 at 1cm
   2 at 2cm  
  ...
1000 at 10m

With logarythmic the values scale by a magnitude. Example for powers of 10:

   0 at 0cm
   1 at 1cm
  10 at 2cm
 100 at 3cm
1000 at 4cm etc.

It is a way to display widely spread data in a compacter format.

See logarithmic scale on wikipedia

Your data has a cluster of values and an outlier - by printing with a logarithmic scale your blob gets shown over distance whatever and the big distance between the blob and the outlier takes less screenarea due to it being logarithmic.

Other examples for log-plots:

and

Related