Prepare Interview

Mock Exams

Make Homepage

Bookmark this page

Subscribe Email Address

Question: How can you create a logarithmic scale in Matplotlib?
Answer: Use the `plt.xscale()` and `plt.yscale()` functions with the argument 'log' to create a logarithmic scale on the x-axis and y-axis, respectively.

Example:

plt.plot([1, 2, 3, 4], [10, 20, 30, 40])
plt.xscale('log')
plt.yscale('log')
plt.show()
Is it helpful? Yes No

Most helpful rated by users:

©2026 WithoutBook