4

I'm using matplotlib to plot a series of datas and get a result as below

enter image description here

But I'm expecting to have a non linear axis as below.

enter image description here

How can I make that kind of plot? Thanks in advance.

1
  • Can you please share the code you have written ? Commented Aug 17, 2016 at 6:44

2 Answers 2

7

You can set the y-axis to logaritmic by writing plt.yscale('log')

full example:

import matplotlib.pyplot as plt
example = [pow(2,i) for i in range(10)]
plt.plot(example)
plt.yscale('log')
plt.show()
Sign up to request clarification or add additional context in comments.

1 Comment

See also documentation here : matplotlib.org/users/…
3

You can use plt.semilogy:

import matplotlib.pyplot as plt

plt.semilogy([i**2 for i in range(100)])
plt.show()

Result:

enter image description here

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.