From: Russell H. <rhe...@il...> - 2011-01-24 19:56:16
|
Hi All, I can't get the x label on the top row of an ImageGrid to display if there is more than one row in the grid. I suspect that something is being clipped somewhere, but have no idea what to do to fix it. (Note, this also happens on the right edge of a ride-sided y axis label.) I have included some minimal sample code below. I'd appreciate it if anyone can point me in the right direction. Cheers, Russ #------------------------------- import matplotlib.pyplot as plt import matplotlib.cm as cm import mpl_toolkits.axes_grid1 as ag import numpy as np fig1 = plt.figure() grid1 = ag.AxesGrid( fig1, 111, nrows_ncols = (1,2), axes_pad = 0.5) grid1[0].axes.xaxis.set_label_position('top') grid1[0].axes.xaxis.set_label_text('foo') grid1[1].axes.xaxis.set_label_position('top') grid1[1].axes.xaxis.set_label_text('bar') grid1[0].axes.yaxis.set_label_position('right') grid1[0].axes.yaxis.set_label_text('foo') grid1[1].axes.yaxis.set_label_position('right') grid1[1].axes.yaxis.set_label_text('bar') fig2 = plt.figure() grid2 = ag.AxesGrid( fig2, 111, nrows_ncols = (2,1), axes_pad = 0.5) grid2[0].axes.xaxis.set_label_position('top') grid2[0].axes.xaxis.set_label_text('bar') grid2[1].axes.xaxis.set_label_position('top') grid2[1].axes.xaxis.set_label_text('bar') grid2[0].axes.yaxis.set_label_position('right') grid2[0].axes.yaxis.set_label_text('foo') grid2[1].axes.yaxis.set_label_position('right') grid2[1].axes.yaxis.set_label_text('bar') plt.show() #------------------------------- -- Russell J. Hewett Ph.D. Candidate Department of Computer Science University of Illinois at Urbana-Champaign www.russellhewett.com |
From: Paul I. <piv...@gm...> - 2011-01-24 20:33:38
|
Russell Hewett, on 2011-01-24 13:56, wrote: > Hi All, > > I can't get the x label on the top row of an ImageGrid to display if there > is more than one row in the grid. I suspect that something is being clipped > somewhere, but have no idea what to do to fix it. (Note, this also happens > on the right edge of a ride-sided y axis label.) > > I have included some minimal sample code below. I'd appreciate it if anyone > can point me in the right direction. > > > Cheers, > Russ Hi Russ, thanks for the report - at a glance, it appears to be a bug in AxesGrid removing redundant labels for shared axis when they align. I've included a temporary workaround for your script, but don't have time to look into it further at the moment. By the way, calling grid[0].axes is redundant, so I just modified it to use grid[0].xaxis, which is equivalent. #------------------------------- import matplotlib.pyplot as plt import matplotlib.cm as cm import mpl_toolkits.axes_grid1 as ag import numpy as np fig1 = plt.figure() grid1 = ag.AxesGrid( fig1, 111, nrows_ncols = (1,2), axes_pad = 0.5) grid1[0].xaxis.set_label_position('top') grid1[0].xaxis.set_label_text('foo') grid1[1].xaxis.set_label_position('top') grid1[1].xaxis.set_label_text('bar') grid1[0].yaxis.set_label_position('right') grid1[0].yaxis.set_label_text('foo') grid1[1].yaxis.set_label_position('right') grid1[1].yaxis.set_label_text('bar') grid1[1].yaxis.label.set_visible(True) # tmp workaround fig2 = plt.figure() grid2 = ag.AxesGrid( fig2, 111, nrows_ncols = (2,1), axes_pad = 0.5) grid2[0].xaxis.set_label_position('top') grid2[0].xaxis.set_label_text('bar') grid2[0].xaxis.label.set_visible(True) # tmp workaround grid2[1].xaxis.set_label_position('top') grid2[1].xaxis.set_label_text('bar') grid2[0].yaxis.set_label_position('right') grid2[0].yaxis.set_label_text('foo') grid2[1].yaxis.set_label_position('right') grid2[1].yaxis.set_label_text('bar') plt.show() #------------------------------- best, -- Paul Ivanov 314 address only used for lists, off-list direct email at: http://pirsquared.org | GPG/PGP key id: 0x0F3E28F7 |
From: Russell H. <rhe...@il...> - 2011-01-24 21:46:31
|
Worked great, thanks! -r On Mon, Jan 24, 2011 at 2:32 PM, Paul Ivanov <piv...@gm...> wrote: > Russell Hewett, on 2011-01-24 13:56, wrote: > > Hi All, > > > > I can't get the x label on the top row of an ImageGrid to display if > there > > is more than one row in the grid. I suspect that something is being > clipped > > somewhere, but have no idea what to do to fix it. (Note, this also > happens > > on the right edge of a ride-sided y axis label.) > > > > I have included some minimal sample code below. I'd appreciate it if > anyone > > can point me in the right direction. > > > > > > Cheers, > > Russ > > Hi Russ, > > thanks for the report - at a glance, it appears to be a bug in > AxesGrid removing redundant labels for shared axis when they > align. I've included a temporary workaround for your script, but > don't have time to look into it further at the moment. By the > way, calling grid[0].axes is redundant, so I just modified it to > use grid[0].xaxis, which is equivalent. > > #------------------------------- > import matplotlib.pyplot as plt > import matplotlib.cm as cm > import mpl_toolkits.axes_grid1 as ag > > import numpy as np > > fig1 = plt.figure() > > grid1 = ag.AxesGrid( fig1, 111, nrows_ncols = (1,2), axes_pad = 0.5) > > grid1[0].xaxis.set_label_position('top') > grid1[0].xaxis.set_label_text('foo') > > grid1[1].xaxis.set_label_position('top') > grid1[1].xaxis.set_label_text('bar') > > grid1[0].yaxis.set_label_position('right') > grid1[0].yaxis.set_label_text('foo') > > grid1[1].yaxis.set_label_position('right') > grid1[1].yaxis.set_label_text('bar') > grid1[1].yaxis.label.set_visible(True) # tmp workaround > > > fig2 = plt.figure() > grid2 = ag.AxesGrid( fig2, 111, nrows_ncols = (2,1), axes_pad = 0.5) > > grid2[0].xaxis.set_label_position('top') > grid2[0].xaxis.set_label_text('bar') > grid2[0].xaxis.label.set_visible(True) # tmp workaround > > grid2[1].xaxis.set_label_position('top') > grid2[1].xaxis.set_label_text('bar') > > grid2[0].yaxis.set_label_position('right') > grid2[0].yaxis.set_label_text('foo') > > grid2[1].yaxis.set_label_position('right') > grid2[1].yaxis.set_label_text('bar') > > plt.show() > #------------------------------- > > best, > -- > Paul Ivanov > 314 address only used for lists, off-list direct email at: > http://pirsquared.org | GPG/PGP key id: 0x0F3E28F7 > > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.10 (GNU/Linux) > > iEYEARECAAYFAk094eYACgkQe+cmRQ8+KPc/qACePreDR4ThGj/2PttN6OaMXm0K > 17YAmwbIpf+++7fYVqI3asKiBf8Z3zlT > =eG7W > -----END PGP SIGNATURE----- > > > ------------------------------------------------------------------------------ > Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)! > Finally, a world-class log management solution at an even better > price-free! > Download using promo code Free_Logger_4_Dev2Dev. Offer expires > February 28th, so secure your free ArcSight Logger TODAY! > http://p.sf.net/sfu/arcsight-sfd2d > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > -- Russell J. Hewett Ph.D. Candidate Department of Computer Science University of Illinois at Urbana-Champaign www.russellhewett.com |
From: Benjamin R. <ben...@ou...> - 2011-01-24 23:56:52
|
On Monday, January 24, 2011, Russell Hewett <rhe...@il...> wrote: > Worked great, thanks! > > -r > > On Mon, Jan 24, 2011 at 2:32 PM, Paul Ivanov <piv...@gm...> wrote: > > Russell Hewett, on 2011-01-24 13:56, wrote: >> Hi All, >> >> I can't get the x label on the top row of an ImageGrid to display if there >> is more than one row in the grid. I suspect that something is being clipped >> somewhere, but have no idea what to do to fix it. (Note, this also happens >> on the right edge of a ride-sided y axis label.) >> >> I have included some minimal sample code below. I'd appreciate it if anyone >> can point me in the right direction. >> >> >> Cheers, >> Russ > > Hi Russ, > > thanks for the report - at a glance, it appears to be a bug in > AxesGrid removing redundant labels for shared axis when they > align. I've included a temporary workaround for your script, but > don't have time to look into it further at the moment. By the > way, calling grid[0].axes is redundant, so I just modified it to > use grid[0].xaxis, which is equivalent. > > #------------------------------- > import matplotlib.pyplot as plt > import matplotlib.cm as cm > import mpl_toolkits.axes_grid1 as ag > > import numpy as np > > fig1 = plt.figure() > > grid1 = ag.AxesGrid( fig1, 111, nrows_ncols = (1,2), axes_pad = 0.5) > > grid1[0].xaxis.set_label_position('top') > grid1[0].xaxis.set_label_text('foo') > > grid1[1].xaxis.set_label_position('top') > grid1[1].xaxis.set_label_text('bar') > > grid1[0].yaxis.set_label_position('right') > grid1[0].yaxis.set_label_text('foo') > > grid1[1].yaxis.set_label_position('right') > grid1[1].yaxis.set_label_text('bar') > grid1[1].yaxis.label.set_visible(True) # tmp workaround > > > fig2 = plt.figure() > grid2 = ag.AxesGrid( fig2, 111, nrows_ncols = (2,1), axes_pad = 0.5) > > grid2[0].xaxis.set_label_position('top') > grid2[0].xaxis.set_label_text('bar') > grid2[0].xaxis.label.set_visible(True) # tmp workaround > > grid2[1].xaxis.set_label_position('top') > grid2[1].xaxis.set_label_text('bar') > > grid2[0].yaxis.set_label_position('right') > grid2[0].yaxis.set_label_text('foo') > > grid2[1].yaxis.set_label_position('right') > grid2[1].yaxis.set_label_text('bar') > > plt.show() > #------------------------------- > > best, > -- > Paul Ivanov > 314 address only used for lists, off-list direct email at: > http://pirsquared.org | GPG/PGP key id: 0x0F3E28F7 > > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.10 (GNU/Linux) > > iEYEARECAAYFAk094eYACgkQe+cmRQ8+KPc/qACePreDR4ThGj/2PttN6OaMXm0K > 17YAmwbIpf+++7fYVqI3asKiBf8Z3zlT > =eG7W > -----END PGP SIGNATURE----- > > ------------------------------------------------------------------------------ > Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)! > Finally, a world-class log management solution at an even better price-free! > Download using promo code Free_Logger_4_Dev2Dev. Offer expires > February 28th, so secure your free ArcSight Logger TODAY! > http://p.sf.net/sfu/arcsight-sfd2d > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > > > -- > Russell J. Hewett > Ph.D. Candidate > Department of Computer Science > University of Illinois at Urbana-Champaign > www.russellhewett.com > > Isn't it a feature? Axes_grid lets you choose the label mode which is 'L' by default. This means that only the outer labels are shown. Or am I missing something in the description of the problem? Ben Root |
From: Russell H. <rhe...@il...> - 2011-01-25 01:43:42
|
This is indeed correct. Somehow I missed this. Setting label_mode = 'all' gets the behavior I wanted. Though, the top and right side are technically on the outside too. Perhaps that should be an available or the default setting? Perhaps the top row should default to labeling on the top, the right column default to labeling on the right, etc? -r On Mon, Jan 24, 2011 at 5:56 PM, Benjamin Root <ben...@ou...> wrote: > > > Isn't it a feature? Axes_grid lets you choose the label mode which is > 'L' by default. This means that only the outer labels are shown. Or > am I missing something in the description of the problem? > > Ben Root > -- Russell J. Hewett Ph.D. Candidate Department of Computer Science University of Illinois at Urbana-Champaign www.russellhewett.com |
From: Jae-Joon L. <lee...@gm...> - 2011-01-25 11:32:15
|
On Tue, Jan 25, 2011 at 10:43 AM, Russell Hewett <rhe...@il...> wrote: > Though, the top and right side are technically on the outside too. Perhaps > that should be an available or the default setting? Perhaps the top row > should default to labeling on the top, the right column default to labeling > on the right, etc? > As the mode name "L" implies, it means "left" and "bottom" side (of the whole grid). Maybe we can have an "outer" mode. Any contribution will be welcomed. Regards, -JJ |