0

how to show the vertical in logarithmic in matplotlib in python.

For instance, y is 1,10,100,1000 instead of 1,2,3,....

I need this because I want to show some comparison which one of them is too big for instance one of them reaches 200 in maximum point while the two others reach to maximum 3.5. I need to show clearly difference of two low, also I should show the third in the same figure!

user10296606
  • 121
  • 1
  • 8

1 Answers1

1

if you use ax:

import matplotlib.pyplot as plt

x=[1,2,3,4,5,6]
y=[2,14,56,170,600,1100]

fig, ax = plt.subplots()
ax.plot(x,y)
ax.set_yscale('log')

or if you use plt:

plt.plot(x,y)
plt.yscale('log')
plt.show()

enter image description here

Alessandro Peca
  • 873
  • 1
  • 15
  • 40