Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
fig, ax = plt.subplots()
x = np.logspace(-4, 8, 100, base=2.0)
y1 = x
y2 = x * x
ax.plot(x,y1)
ax.plot(x,y2)
ax.set_xscale('log')
ax.set_yscale('log')
formatter = matplotlib.ticker.ScalarFormatter(useOffset = False)
ax.yaxis.set_major_formatter(formatter)
ax.xaxis.set_major_formatter(formatter)
ax.xaxis.set_ticks(np.logspace(-4, 8, 13, base=2.0))
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment