From: Sean L. <ody...@gm...> - 2015-05-26 17:07:08
Attachments:
BugDemo.py
BugDemo.pdf
|
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 |
From: Sterling S. <sm...@fu...> - 2015-05-26 19:32:28
|
Sean, Do you need an `annotate`, or just a `text`? `text` has the `transform` keyword, to which you can pass `ax.transAxes`. ax.text(.9,.9, r"$\mathbf{" + lab + ")}$”,transform=ax.transAxes,ha=‘right’,va=‘center’) -Sterling On May 26, 2015, at 10:06AM, Sean Lake <ody...@gm...> wrote: > 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 > > <BugDemo.py><BugDemo.pdf>------------------------------------------------------------------------------ > 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 > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users |
From: Sean L. <ody...@gm...> - 2015-05-26 19:00:22
|
Sterling, Thanks for the pointer. I've already used a workaround where I used "data" coordinates and put it at: 0.9 * (xmax - xmin) + xmin, and similar for y. I'm really only reporting this so that it can be fixed if there is someone who does need to annotate something in a grid. Sean > On May 26, 2015, at 11:54, Sterling Smith <sm...@fu...> wrote: > > Sean, > > Do you need an `annotate`, or just a `text`? `text` has the `transform` keyword, to which you can pass `ax.transAxes`. > > ax.text(.9,.9, r"$\mathbf{" + lab + ")}$”,transform=ax.transAxes,ha=‘right’,va=‘center’) > > -Sterling > > On May 26, 2015, at 10:06AM, Sean Lake <ody...@gm...> wrote: > >> 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 >> >> <BugDemo.py><BugDemo.pdf>------------------------------------------------------------------------------ >> 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 >> Mat...@li... >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users > |
From: Benjamin R. <ben...@ou...> - 2015-05-26 19:10:36
|
I think this is a feature/bug that got reverted in the master branch. Perhaps you could try building matplotlib from source and seeing if the problem goes away? Cheers! Ben Root On Tue, May 26, 2015 at 3:00 PM, Sean Lake <ody...@gm...> wrote: > Sterling, > > Thanks for the pointer. I've already used a workaround where I used "data" > coordinates and put it at: > 0.9 * (xmax - xmin) + xmin, and similar for y. > > I'm really only reporting this so that it can be fixed if there is someone > who does need to annotate something in a grid. > > Sean > > > On May 26, 2015, at 11:54, Sterling Smith <sm...@fu...> > wrote: > > > > Sean, > > > > Do you need an `annotate`, or just a `text`? `text` has the `transform` > keyword, to which you can pass `ax.transAxes`. > > > > ax.text(.9,.9, r"$\mathbf{" + lab + > ")}$”,transform=ax.transAxes,ha=‘right’,va=‘center’) > > > > -Sterling > > > > On May 26, 2015, at 10:06AM, Sean Lake <ody...@gm...> wrote: > > > >> 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 > >> > >> > <BugDemo.py><BugDemo.pdf>------------------------------------------------------------------------------ > >> 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 > >> Mat...@li... > >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > > > > > ------------------------------------------------------------------------------ > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > |
From: Eric F. <ef...@ha...> - 2015-05-26 19:55:23
|
On 2015/05/26 9:10 AM, Benjamin Root wrote: > I think this is a feature/bug that got reverted in the master branch. > Perhaps you could try building matplotlib from source and seeing if the > problem goes away? Ben, it looks familiar, and related to a bizarre feature that I thought we had eliminated--but I just tried it with master, and it's still there. Maybe the change is still languishing in an open PR. Sean, I think you are understandably misunderstanding the confusing annotation API. ax.annotate( r"$\mathbf{" + label + ")}$", xy=(0.9, 0.9), xycoords="axes fraction", fontsize=14 ) If you change your annotation call to the simpler version above, I think it will do what you intended. Eric > > Cheers! > Ben Root > > On Tue, May 26, 2015 at 3:00 PM, Sean Lake <ody...@gm... > <mailto:ody...@gm...>> wrote: > > Sterling, > > Thanks for the pointer. I've already used a workaround where I used > "data" coordinates and put it at: > 0.9 * (xmax - xmin) + xmin, and similar for y. > > I'm really only reporting this so that it can be fixed if there is > someone who does need to annotate something in a grid. > > Sean > > > On May 26, 2015, at 11:54, Sterling Smith <sm...@fu... > <mailto:sm...@fu...>> wrote: > > > > Sean, > > > > Do you need an `annotate`, or just a `text`? `text` has the > `transform` keyword, to which you can pass `ax.transAxes`. > > > > ax.text(.9,.9, r"$\mathbf{" + lab + > ")}$”,transform=ax.transAxes,ha=‘right’,va=‘center’) > > > > -Sterling > > > > On May 26, 2015, at 10:06AM, Sean Lake <ody...@gm... > <mailto:ody...@gm...>> wrote: > > > >> 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 > >> > >> > <BugDemo.py><BugDemo.pdf>------------------------------------------------------------------------------ > >> 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 > >> Mat...@li... > <mailto:Mat...@li...> > >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > > > > ------------------------------------------------------------------------------ > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > <mailto:Mat...@li...> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > > > > ------------------------------------------------------------------------------ > > > > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > |