Hello all, I'm using matplotlib 1.4.3 installed using fink with python 2.7.
I'm trying to produce a grid of plots using gridspec that has annotations to label each plot. Here is the call to annotate the current axes: ax.annotate( r"$\mathbf{" + lab + ")}$", xy=(0.5*(xmin+xmax), 0.5*(ymin+ymax)), xytext=(0.9, 0.9), textcoords="axes fraction", fontsize=14 ) Where ax is initialized by: ax = plt.subplot(gs[ coords[0], coords[1] ]) and gs by: gs = mpgs.GridSpec( 3, 2, wspace=0.0, hspace=0.0 ) The trouble comes in when abs(ymax) < abs(ymin). When that is true, the labels are offset upward by one row, for some reason. I've attached a script that demonstrates the problem, and an example of the output. I can work around this problem by using "data" coordinates, but even so this reveals a bug somewhere. Thanks, Sean Lake
#!/sw/bin/python2.7 import matplotlib matplotlib.use( "Agg" ) import matplotlib.figure as pltfig import matplotlib.pyplot as plt import matplotlib.gridspec as mpgs plt.close("all") #plot grid plt.close() plt.figure( figsize=(6.5, 9.0), subplotpars=pltfig.SubplotParams( top=0.95, left=0.1, bottom=0.08, right=0.98 )) gs = mpgs.GridSpec( 3, 2, wspace=0.0, hspace=0.0 ) PlotOrder = [ (0, 0), (0, 1), (1, 0), (1, 1), (2, 0), (2, 1) ] panellabels = [ "a", "b", "c", "d", "e", "f" ] xmin, xmax = (-3.0, 3.0) ymin, ymax = (-5.0, 5.0) #This works fine ymin, ymax = (-5.0, 4.999) #This breaks the labeling for coords, label in zip( PlotOrder, panellabels ): ax = plt.subplot(gs[ coords[0], coords[1] ]) ax.set_xlim( (xmin, xmax) ) ax.set_ylim( (ymin, ymax) ) ax.annotate( r"$\mathbf{" + label + ")}$", xy=(0.5*(xmin+xmax), 0.5*(ymin+ymax)), xytext=(0.9, 0.9), textcoords="axes fraction", fontsize=14 ) plt.savefig( "BugDemo.pdf", fmt="pdf" )
BugDemo.pdf
Description: Adobe PDF document
------------------------------------------------------------------------------ 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 Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users