Skip to content

Instantly share code, notes, and snippets.

@keisukefukuda
Created November 12, 2014 23:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save keisukefukuda/1447c893f8cffca63318 to your computer and use it in GitHub Desktop.
Save keisukefukuda/1447c893f8cffca63318 to your computer and use it in GitHub Desktop.
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