Discussion:
[Matplotlib-users] How to draw circles in logscale plots
LowDepth
2015-04-08 16:49:52 UTC
Permalink
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.
Benjamin Root
2015-05-07 15:28:05 UTC
Permalink
A quick-n-dirty way would be to use markers via the scatter() function.
Just set the facecolor to 'none', and some very large markersize value.

Ben Root
Post by LowDepth
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()
--
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.
------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
Matplotlib-users mailing list
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Loading...