LowDepth
2015-04-08 16:49:52 UTC
Hello,
how can I plot circles or other shapes in plots which have logarithmic axis?
I have a grid of 3 plots and want to plot some kind of sketches in the lower
right corner of
each subplot. How should I do that?
import numpy as np
from matplotlib import pyplot as plt
from matplotlib import gridspec
fig = plt.figure(figsize=(6, 10))
gs = gridspec.GridSpec(3, 1, height_ratios=[1.5, 1, 1])#, height_ratios=[2,
1, 1])
ax0 = plt.subplot(gs[0])
ax1 = plt.subplot(gs[1])
ax2 = plt.subplot(gs[2])
plt.setp(ax_new.get_yticklabels(), visible=False)
plt.setp(ax_new.get_xticklabels(), visible=False)
ax_new = fig.add_axes([0,0,1,1], frameon=False,aspect="equal")
ax_new.axes.get_yaxis().set_visible(False)
ax_new.axes.get_xaxis().set_visible(False)
circle1=plt.Circle((0.2,0.0),0.05, color="0.8")
circle2=plt.Circle((0.4,0.0),0.05, color="0.8")
ax_new.add_artist(circle1)
ax_new.add_artist(circle2)
ax0.semilogx(x,x**2, "k-", linewidth=2)
ax1.semilogx(x,x**3, "k--", linewidth=2)
ax2.semilogx(x,np.exp(-x)+x**4, "k-.", linewidth=2)
plt.tight_layout()
plt.show()
--
View this message in context: http://matplotlib.1069221.n5.nabble.com/How-to-draw-circles-in-logscale-plots-tp45367.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
how can I plot circles or other shapes in plots which have logarithmic axis?
I have a grid of 3 plots and want to plot some kind of sketches in the lower
right corner of
each subplot. How should I do that?
import numpy as np
from matplotlib import pyplot as plt
from matplotlib import gridspec
fig = plt.figure(figsize=(6, 10))
gs = gridspec.GridSpec(3, 1, height_ratios=[1.5, 1, 1])#, height_ratios=[2,
1, 1])
ax0 = plt.subplot(gs[0])
ax1 = plt.subplot(gs[1])
ax2 = plt.subplot(gs[2])
plt.setp(ax_new.get_yticklabels(), visible=False)
plt.setp(ax_new.get_xticklabels(), visible=False)
ax_new = fig.add_axes([0,0,1,1], frameon=False,aspect="equal")
ax_new.axes.get_yaxis().set_visible(False)
ax_new.axes.get_xaxis().set_visible(False)
circle1=plt.Circle((0.2,0.0),0.05, color="0.8")
circle2=plt.Circle((0.4,0.0),0.05, color="0.8")
ax_new.add_artist(circle1)
ax_new.add_artist(circle2)
ax0.semilogx(x,x**2, "k-", linewidth=2)
ax1.semilogx(x,x**3, "k--", linewidth=2)
ax2.semilogx(x,np.exp(-x)+x**4, "k-.", linewidth=2)
plt.tight_layout()
plt.show()
--
View this message in context: http://matplotlib.1069221.n5.nabble.com/How-to-draw-circles-in-logscale-plots-tp45367.html
Sent from the matplotlib - users mailing list archive at Nabble.com.