You can subscribe to this list here.
| 2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(3) |
Jun
|
Jul
|
Aug
(12) |
Sep
(12) |
Oct
(56) |
Nov
(65) |
Dec
(37) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2004 |
Jan
(59) |
Feb
(78) |
Mar
(153) |
Apr
(205) |
May
(184) |
Jun
(123) |
Jul
(171) |
Aug
(156) |
Sep
(190) |
Oct
(120) |
Nov
(154) |
Dec
(223) |
| 2005 |
Jan
(184) |
Feb
(267) |
Mar
(214) |
Apr
(286) |
May
(320) |
Jun
(299) |
Jul
(348) |
Aug
(283) |
Sep
(355) |
Oct
(293) |
Nov
(232) |
Dec
(203) |
| 2006 |
Jan
(352) |
Feb
(358) |
Mar
(403) |
Apr
(313) |
May
(165) |
Jun
(281) |
Jul
(316) |
Aug
(228) |
Sep
(279) |
Oct
(243) |
Nov
(315) |
Dec
(345) |
| 2007 |
Jan
(260) |
Feb
(323) |
Mar
(340) |
Apr
(319) |
May
(290) |
Jun
(296) |
Jul
(221) |
Aug
(292) |
Sep
(242) |
Oct
(248) |
Nov
(242) |
Dec
(332) |
| 2008 |
Jan
(312) |
Feb
(359) |
Mar
(454) |
Apr
(287) |
May
(340) |
Jun
(450) |
Jul
(403) |
Aug
(324) |
Sep
(349) |
Oct
(385) |
Nov
(363) |
Dec
(437) |
| 2009 |
Jan
(500) |
Feb
(301) |
Mar
(409) |
Apr
(486) |
May
(545) |
Jun
(391) |
Jul
(518) |
Aug
(497) |
Sep
(492) |
Oct
(429) |
Nov
(357) |
Dec
(310) |
| 2010 |
Jan
(371) |
Feb
(657) |
Mar
(519) |
Apr
(432) |
May
(312) |
Jun
(416) |
Jul
(477) |
Aug
(386) |
Sep
(419) |
Oct
(435) |
Nov
(320) |
Dec
(202) |
| 2011 |
Jan
(321) |
Feb
(413) |
Mar
(299) |
Apr
(215) |
May
(284) |
Jun
(203) |
Jul
(207) |
Aug
(314) |
Sep
(321) |
Oct
(259) |
Nov
(347) |
Dec
(209) |
| 2012 |
Jan
(322) |
Feb
(414) |
Mar
(377) |
Apr
(179) |
May
(173) |
Jun
(234) |
Jul
(295) |
Aug
(239) |
Sep
(276) |
Oct
(355) |
Nov
(144) |
Dec
(108) |
| 2013 |
Jan
(170) |
Feb
(89) |
Mar
(204) |
Apr
(133) |
May
(142) |
Jun
(89) |
Jul
(160) |
Aug
(180) |
Sep
(69) |
Oct
(136) |
Nov
(83) |
Dec
(32) |
| 2014 |
Jan
(71) |
Feb
(90) |
Mar
(161) |
Apr
(117) |
May
(78) |
Jun
(94) |
Jul
(60) |
Aug
(83) |
Sep
(102) |
Oct
(132) |
Nov
(154) |
Dec
(96) |
| 2015 |
Jan
(45) |
Feb
(138) |
Mar
(176) |
Apr
(132) |
May
(119) |
Jun
(124) |
Jul
(77) |
Aug
(31) |
Sep
(34) |
Oct
(22) |
Nov
(23) |
Dec
(9) |
| 2016 |
Jan
(26) |
Feb
(17) |
Mar
(10) |
Apr
(8) |
May
(4) |
Jun
(8) |
Jul
(6) |
Aug
(5) |
Sep
(9) |
Oct
(4) |
Nov
|
Dec
|
| 2017 |
Jan
(5) |
Feb
(7) |
Mar
(1) |
Apr
(5) |
May
|
Jun
(3) |
Jul
(6) |
Aug
(1) |
Sep
|
Oct
(2) |
Nov
(1) |
Dec
|
| 2018 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2020 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2025 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
|
|
1
(16) |
2
(22) |
3
(28) |
4
(17) |
5
(17) |
6
(7) |
|
7
|
8
(15) |
9
(28) |
10
(26) |
11
(28) |
12
(19) |
13
(5) |
|
14
(3) |
15
(21) |
16
(28) |
17
(11) |
18
(18) |
19
(6) |
20
(5) |
|
21
(18) |
22
(11) |
23
(22) |
24
(28) |
25
(17) |
26
(17) |
27
(7) |
|
28
(16) |
29
(24) |
30
(25) |
31
(14) |
|
|
|
|
From: Eric F. <ef...@ha...> - 2010-03-06 00:09:02
|
David Arnold wrote: > All, > > In one post from John Hunter, I heard the word "traits", which I assume is from the enthought distribution. > > Is there a move in matplotlib toward the "trait" technology taking place? How about for Python in general? > No to both, as far as I know. Every now and then the question of using traits in mpl is raised, and some trials have been done, but to date it has not caught on. Eric > Thanks. > > David. |
|
From: David A. <dwa...@su...> - 2010-03-05 22:29:56
|
All, In one post from John Hunter, I heard the word "traits", which I assume is from the enthought distribution. Is there a move in matplotlib toward the "trait" technology taking place? How about for Python in general? Thanks. David. |
|
From: Jae-Joon L. <lee...@gm...> - 2010-03-05 21:40:11
|
divider.get_horizontal() returns a list of size objects (http://matplotlib.sourceforge.net/mpl_toolkits/axes_grid/api/axes_size_api.html#module-mpl_toolkits.axes_grid.axes_size) that are currently used. For example, cax = divider.new_horizontal(size="5%", pad=0.05) horiz_list = divider.get_horizontal() horiz_list[0] is x-size of ax, horiz_list[1] is pad size, and horiz_list[2] is x-size of cax. You can modify those size objects (but usually they don't provide public interfaces). Or you can substitute any of them with a valid size object. horiz_list[1]._fixed_size = 0. # makes pad 0 inches horiz_list[2]._fraction = 0.1 # width of cax becomes 10% of the width of ax Or from mpl_toolkits.axes_grid.axes_size import Fixed, Fraction horiz_list[1] = Fixed(0.) horiz_list[2] = Fraction(0.1, horiz_list[0]) There are not much of documentation available, but this may be helpful. http://matplotlib.sourceforge.net/mpl_toolkits/axes_grid/users/axes_divider.html Regards, -JJ On Fri, Mar 5, 2010 at 3:38 PM, Thomas Robitaille <tho...@gm...> wrote: > Hi Jae-Joon, > > Thanks for your help! One last question - if I create a colorbar axes with > > cax = divider.new_horizontal(size="5%", pad=0.05) > > Is it possible to then modify the size and pad parameters, or do I need to delete the axes and start again? > > Cheers, > > Tom > > On Mar 5, 2010, at 12:20 PM, Jae-Joon Lee wrote: > >> Unfortunately, axes_grid toolkit (in most cases) creates an axes using >> its own Axes class by default. Here is some more details. >> >> http://matplotlib.sourceforge.net/mpl_toolkits/axes_grid/users/overview.html#axisline >> >> To use mpl's original Axes class, append axes_class parameter. >> >> import matplotlib.axes as maxes >> cax = divider.new_horizontal(size="5%", pad=0.05, axes_class=maxes.Axes) >> >> Then your code should work. >> >> Just in case, with the axes_grid's own Axes class, instead of looping >> over major_ticks, you do >> >> cax.axis["left"].toggle(all=False) >> cax.axis["right"].toggle(all=True) >> >> Regards, >> >> -JJ >> >> >> On Fri, Mar 5, 2010 at 9:38 AM, Thomas Robitaille >> <tho...@gm...> wrote: >>> Hi Jae-Joon, >>> >>> I am encountering another issue, when using the method you suggest in combination with the parasite_axes from the matplotlib toolkit: >>> >>> --- >>> >>> import matplotlib.pyplot as mpl >>> import numpy as np >>> from mpl_toolkits.axes_grid import make_axes_locatable >>> import mpl_toolkits.axes_grid.parasite_axes as mpltk >>> >>> fig = mpl.figure() >>> >>> ax = mpltk.SubplotHost(fig, 1, 1, 1) >>> fig.add_axes(ax) >>> >>> divider = make_axes_locatable(ax) >>> >>> cax = divider.new_horizontal(size="5%", pad=0.05) >>> fig.add_axes(cax) >>> >>> image = ax.imshow(np.random.random((100,100))) >>> >>> cb = fig.colorbar(image, cax=cax) >>> >>> --- >>> >>> In the above case, the labels end up on the wrong side of the plot, and the usual method for changing the label position, e.g.: >>> >>> for tick in cax.xaxis.get_major_ticks(): >>> tick.tick1On = True >>> tick.tick2On = True >>> tick.label1On = False >>> tick.label2On = True >>> >>> does not work. Do you have any idea why this might be? >>> >>> Thanks for any help, >>> >>> Thomas >>> >>> >>> >>> On Mar 4, 2010, at 10:28 PM, Jae-Joon Lee wrote: >>> >>>> see >>>> >>>> http://www.mail-archive.com/mat...@li.../msg15919.html >>>> >>>> axes_grid toolkit provides some helper function that utilizes >>>> axes_locator (take a look at demo_locatable_axes_easy function in the >>>> example below) >>>> >>>> http://matplotlib.sourceforge.net/examples/axes_grid/demo_axes_divider.html >>>> >>>> -JJ >>>> >>>> >>>> >>>> >>>> On Thu, Mar 4, 2010 at 9:05 PM, Thomas Robitaille >>>> <tho...@gm...> wrote: >>>>> Hi, >>>>> >>>>> I am trying to set up a colorbar that automatically resizes if I zoom in to an image (which changes the aspect ratio of the axes, so I want the colorbar to get resized too). Let's say I have two Axes instances, say ax (for the main image) and cax (for the colorbar). I can set up a callback if the view limits in one axes change, for example >>>>> >>>>> ax.callbacks.connect('xlim_changed', update_colorbar) >>>>> ax.callbacks.connect('ylim_changed', update_colorbar) >>>>> >>>>> Now I can store a reference to cax inside ax: >>>>> >>>>> ax._cax = cax >>>>> >>>>> And I can now define update_colorbar so that it basically changes the position of cax: >>>>> >>>>> def update_colorbar(ax): >>>>> >>>>> # Get current position >>>>> xmin = ax..get_position().xmin >>>>> ... >>>>> >>>>> # Compute new colorbar position >>>>> ... >>>>> >>>>> # Set new position >>>>> ax._cax.set_position(...) >>>>> >>>>> # Return axes instance >>>>> return ax >>>>> >>>>> Now the issue is that if I select a region of the image to zoom into, then as soon as I've selected the region, update_colorbar gets called, but by then, the aspect ratio of ax hasn't changed, and so the position I find when I do xmin = ax..get_position().xmin in update_colorbar is the *old* position of ax, not the new one. So the colorbar position is always one step behind compared to the main image axes. >>>>> >>>>> Can anyone think of any way that would avoid this issue, and to be able to use the *new* position of ax inside update_colorbar? >>>>> >>>>> Thanks in advance for any help, >>>>> >>>>> Thomas >>>>> ------------------------------------------------------------------------------ >>>>> Download Intel® Parallel Studio Eval >>>>> Try the new software tools for yourself. Speed compiling, find bugs >>>>> proactively, and fine-tune applications for parallel performance. >>>>> See why Intel Parallel Studio got high marks during beta. >>>>> http://p.sf.net/sfu/intel-sw-dev >>>>> _______________________________________________ >>>>> Matplotlib-users mailing list >>>>> Mat...@li... >>>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >>>>> >>> >>> > > |
|
From: Thomas R. <tho...@gm...> - 2010-03-05 20:38:23
|
Hi Jae-Joon, Thanks for your help! One last question - if I create a colorbar axes with cax = divider.new_horizontal(size="5%", pad=0.05) Is it possible to then modify the size and pad parameters, or do I need to delete the axes and start again? Cheers, Tom On Mar 5, 2010, at 12:20 PM, Jae-Joon Lee wrote: > Unfortunately, axes_grid toolkit (in most cases) creates an axes using > its own Axes class by default. Here is some more details. > > http://matplotlib.sourceforge.net/mpl_toolkits/axes_grid/users/overview.html#axisline > > To use mpl's original Axes class, append axes_class parameter. > > import matplotlib.axes as maxes > cax = divider.new_horizontal(size="5%", pad=0.05, axes_class=maxes.Axes) > > Then your code should work. > > Just in case, with the axes_grid's own Axes class, instead of looping > over major_ticks, you do > > cax.axis["left"].toggle(all=False) > cax.axis["right"].toggle(all=True) > > Regards, > > -JJ > > > On Fri, Mar 5, 2010 at 9:38 AM, Thomas Robitaille > <tho...@gm...> wrote: >> Hi Jae-Joon, >> >> I am encountering another issue, when using the method you suggest in combination with the parasite_axes from the matplotlib toolkit: >> >> --- >> >> import matplotlib.pyplot as mpl >> import numpy as np >> from mpl_toolkits.axes_grid import make_axes_locatable >> import mpl_toolkits.axes_grid.parasite_axes as mpltk >> >> fig = mpl.figure() >> >> ax = mpltk.SubplotHost(fig, 1, 1, 1) >> fig.add_axes(ax) >> >> divider = make_axes_locatable(ax) >> >> cax = divider.new_horizontal(size="5%", pad=0.05) >> fig.add_axes(cax) >> >> image = ax.imshow(np.random.random((100,100))) >> >> cb = fig.colorbar(image, cax=cax) >> >> --- >> >> In the above case, the labels end up on the wrong side of the plot, and the usual method for changing the label position, e.g.: >> >> for tick in cax.xaxis.get_major_ticks(): >> tick.tick1On = True >> tick.tick2On = True >> tick.label1On = False >> tick.label2On = True >> >> does not work. Do you have any idea why this might be? >> >> Thanks for any help, >> >> Thomas >> >> >> >> On Mar 4, 2010, at 10:28 PM, Jae-Joon Lee wrote: >> >>> see >>> >>> http://www.mail-archive.com/mat...@li.../msg15919.html >>> >>> axes_grid toolkit provides some helper function that utilizes >>> axes_locator (take a look at demo_locatable_axes_easy function in the >>> example below) >>> >>> http://matplotlib.sourceforge.net/examples/axes_grid/demo_axes_divider.html >>> >>> -JJ >>> >>> >>> >>> >>> On Thu, Mar 4, 2010 at 9:05 PM, Thomas Robitaille >>> <tho...@gm...> wrote: >>>> Hi, >>>> >>>> I am trying to set up a colorbar that automatically resizes if I zoom in to an image (which changes the aspect ratio of the axes, so I want the colorbar to get resized too). Let's say I have two Axes instances, say ax (for the main image) and cax (for the colorbar). I can set up a callback if the view limits in one axes change, for example >>>> >>>> ax.callbacks.connect('xlim_changed', update_colorbar) >>>> ax.callbacks.connect('ylim_changed', update_colorbar) >>>> >>>> Now I can store a reference to cax inside ax: >>>> >>>> ax._cax = cax >>>> >>>> And I can now define update_colorbar so that it basically changes the position of cax: >>>> >>>> def update_colorbar(ax): >>>> >>>> # Get current position >>>> xmin = ax..get_position().xmin >>>> ... >>>> >>>> # Compute new colorbar position >>>> ... >>>> >>>> # Set new position >>>> ax._cax.set_position(...) >>>> >>>> # Return axes instance >>>> return ax >>>> >>>> Now the issue is that if I select a region of the image to zoom into, then as soon as I've selected the region, update_colorbar gets called, but by then, the aspect ratio of ax hasn't changed, and so the position I find when I do xmin = ax..get_position().xmin in update_colorbar is the *old* position of ax, not the new one. So the colorbar position is always one step behind compared to the main image axes. >>>> >>>> Can anyone think of any way that would avoid this issue, and to be able to use the *new* position of ax inside update_colorbar? >>>> >>>> Thanks in advance for any help, >>>> >>>> Thomas >>>> ------------------------------------------------------------------------------ >>>> Download Intel® Parallel Studio Eval >>>> Try the new software tools for yourself. Speed compiling, find bugs >>>> proactively, and fine-tune applications for parallel performance. >>>> See why Intel Parallel Studio got high marks during beta. >>>> http://p.sf.net/sfu/intel-sw-dev >>>> _______________________________________________ >>>> Matplotlib-users mailing list >>>> Mat...@li... >>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >>>> >> >> |
|
From: Friedrich R. <fri...@gm...> - 2010-03-05 20:36:59
|
2010/3/5 David Goldsmith <d_l...@ya...>: > I think it's a bug in numpy.ma._extrema_operations.reduce (at least Pierre GM couldn't explain it away and instructed me to file a bug ticket on it over there, which I did; w/ your permission, I'll add your code to that ticket?) - at the very least, it should be able to handle zero-size arrays more robustly (i.e., w/out raising an exception) IMO. Of course, that doesn't mean that once it's been fixed, imshow (or cm, which is apparently what's really calling it) won't encounter some other problem on account of the fix, but I guess we'll have to cross that bridge when we come to it? Hmm, IMO it's correct to raise because the minimum of nothing isn't defined? Matplotlib tries to find a minimum. Anyway, you cannot draw ndarrays arr with 0 in arr.shape. So I think matplotlib should maybe silently skip attempting to draw it? Friedrich |
|
From: David G. <d_l...@ya...> - 2010-03-05 20:03:43
|
(Pierre GM: are you subscribed to this list? If so, sorry for cc-ing you.)
--- On Fri, 3/5/10, Friedrich Romstedt <fri...@gm...> wrote:
> From: Friedrich Romstedt <fri...@gm...>
> Subject: Re: [Matplotlib-users] Mysterious "ValueError: zero-size array..."
> To: "David Goldsmith" <d_l...@ya...>
> Date: Friday, March 5, 2010, 10:46 AM
> I can reproduce the error with:
>
> >>> argW = numpy.asarray([[0, 1, 2], [3, 4, 5],
> [6, 7, 8], [9, 10, 11]])
> >>> argW
> array([[ 0, 1, 2],
> [ 3, 4, 5],
> [ 6, 7, 8],
> [ 9, 10, 11]])
> >>> argW[0:1, 0:0]
> array([], shape=(1, 0), dtype=int32)
> >>> d1.axes.imshow(argW[0:1, 0:0])
> Traceback (most recent call last):
> File "<stdin>", line 1, in ?
> File
> "D:\Programme\Programmierung\python-2.4.1\lib\site-packages\matplotlib\axes.py",
> line 5471, in imshow
> im.autoscale_None()
> File
> "D:\Programme\Programmierung\python-2.4.1\lib\site-packages\matplotlib\cm.py",
> line 148, in autoscale_None
> self.norm.autoscale_None(self._A)
> File
> "D:\Programme\Programmierung\python-2.4.1\lib\site-packages\matplotlib\colors.py",
> line 682, in autoscale_None
> if self.vmin is None: self.vmin =
> ma.minimum(A)
> File
> "D:\Programme\Programmierung\python-2.4.1\lib\site-packages\numpy\ma\core.py",
> line 3042, in __call__
> return self.reduce(a)
> File
> "D:\Programme\Programmierung\python-2.4.1\lib\site-packages\numpy\ma\core.py",
> line 3057, in reduce
> t = self.ufunc.reduce(target, **kargs)
> ValueError: zero-size array to ufunc.reduce without
> identity
>
> So it seems to me that you pass in an array with shape <
> 4 in at least
> one of the dimensions?
Thanks for your reply, Friedrich, and for creating the reproducing example!
I think it's a bug in numpy.ma._extrema_operations.reduce (at least Pierre GM couldn't explain it away and instructed me to file a bug ticket on it over there, which I did; w/ your permission, I'll add your code to that ticket?) - at the very least, it should be able to handle zero-size arrays more robustly (i.e., w/out raising an exception) IMO. Of course, that doesn't mean that once it's been fixed, imshow (or cm, which is apparently what's really calling it) won't encounter some other problem on account of the fix, but I guess we'll have to cross that bridge when we come to it?
> NB: You lose at most 3 pixels at the border of your image
> when drawing
> it the method you proposed, because the int floor'ing will
> cause that.
I was afraid of that (fancy index math has never been one of my strong suits) but ultimately I'm making ~5e3 x ~5e3 images (which is why I'm having to create the images that way in the first place - I was getting a memory error trying to imshow the whole full-resolution image w/ one call), so that loss is negligible (but if you can show me how to avoid it, I'd be much appreciative).
> NB II: Something happened, you sent the last message four
> times?
Yeah, my apologies, I'm not sure why that happened; maybe was having connectivity issues and wasn't sure if I'd sent it successfully? Anyway, sorry 'bout that. :-(
Thanks again!
DG
>
> Friedrich
>
|
|
From: Bruce F. <br...@cl...> - 2010-03-05 18:11:38
|
Has anyone had any success in making land or sea locations transparent in a resulting .png? There are instances when I would like an image to be overlayed on a map and let the underlying terrain map show through. Using an image as a ground overlay in Google Earth would be an example of such a usage. Also, I've noticed that figurePatch.set_alpha(0.0) does not apply transparency within the bounding box. I'm still ending up with white areas within the bounding box. Can transparency be set within the basemap box? Thanks so much! Bruce --------------------------------------- Bruce W. Ford Clear Science, Inc. br...@cl... http://www.ClearScienceInc.com Phone/Fax: 904-379-9704 8241 Parkridge Circle N. Jacksonville, FL 32211 Skype: bruce.w.ford Google Talk: fo...@gm... |
|
From: Jae-Joon L. <lee...@gm...> - 2010-03-05 17:20:46
|
Unfortunately, axes_grid toolkit (in most cases) creates an axes using its own Axes class by default. Here is some more details. http://matplotlib.sourceforge.net/mpl_toolkits/axes_grid/users/overview.html#axisline To use mpl's original Axes class, append axes_class parameter. import matplotlib.axes as maxes cax = divider.new_horizontal(size="5%", pad=0.05, axes_class=maxes.Axes) Then your code should work. Just in case, with the axes_grid's own Axes class, instead of looping over major_ticks, you do cax.axis["left"].toggle(all=False) cax.axis["right"].toggle(all=True) Regards, -JJ On Fri, Mar 5, 2010 at 9:38 AM, Thomas Robitaille <tho...@gm...> wrote: > Hi Jae-Joon, > > I am encountering another issue, when using the method you suggest in combination with the parasite_axes from the matplotlib toolkit: > > --- > > import matplotlib.pyplot as mpl > import numpy as np > from mpl_toolkits.axes_grid import make_axes_locatable > import mpl_toolkits.axes_grid.parasite_axes as mpltk > > fig = mpl.figure() > > ax = mpltk.SubplotHost(fig, 1, 1, 1) > fig.add_axes(ax) > > divider = make_axes_locatable(ax) > > cax = divider.new_horizontal(size="5%", pad=0.05) > fig.add_axes(cax) > > image = ax.imshow(np.random.random((100,100))) > > cb = fig.colorbar(image, cax=cax) > > --- > > In the above case, the labels end up on the wrong side of the plot, and the usual method for changing the label position, e.g.: > > for tick in cax.xaxis.get_major_ticks(): > tick.tick1On = True > tick.tick2On = True > tick.label1On = False > tick.label2On = True > > does not work. Do you have any idea why this might be? > > Thanks for any help, > > Thomas > > > > On Mar 4, 2010, at 10:28 PM, Jae-Joon Lee wrote: > >> see >> >> http://www.mail-archive.com/mat...@li.../msg15919.html >> >> axes_grid toolkit provides some helper function that utilizes >> axes_locator (take a look at demo_locatable_axes_easy function in the >> example below) >> >> http://matplotlib.sourceforge.net/examples/axes_grid/demo_axes_divider.html >> >> -JJ >> >> >> >> >> On Thu, Mar 4, 2010 at 9:05 PM, Thomas Robitaille >> <tho...@gm...> wrote: >>> Hi, >>> >>> I am trying to set up a colorbar that automatically resizes if I zoom in to an image (which changes the aspect ratio of the axes, so I want the colorbar to get resized too). Let's say I have two Axes instances, say ax (for the main image) and cax (for the colorbar). I can set up a callback if the view limits in one axes change, for example >>> >>> ax.callbacks.connect('xlim_changed', update_colorbar) >>> ax.callbacks.connect('ylim_changed', update_colorbar) >>> >>> Now I can store a reference to cax inside ax: >>> >>> ax._cax = cax >>> >>> And I can now define update_colorbar so that it basically changes the position of cax: >>> >>> def update_colorbar(ax): >>> >>> # Get current position >>> xmin = ax..get_position().xmin >>> ... >>> >>> # Compute new colorbar position >>> ... >>> >>> # Set new position >>> ax._cax.set_position(...) >>> >>> # Return axes instance >>> return ax >>> >>> Now the issue is that if I select a region of the image to zoom into, then as soon as I've selected the region, update_colorbar gets called, but by then, the aspect ratio of ax hasn't changed, and so the position I find when I do xmin = ax..get_position().xmin in update_colorbar is the *old* position of ax, not the new one. So the colorbar position is always one step behind compared to the main image axes. >>> >>> Can anyone think of any way that would avoid this issue, and to be able to use the *new* position of ax inside update_colorbar? >>> >>> Thanks in advance for any help, >>> >>> Thomas >>> ------------------------------------------------------------------------------ >>> Download Intel® Parallel Studio Eval >>> Try the new software tools for yourself. Speed compiling, find bugs >>> proactively, and fine-tune applications for parallel performance. >>> See why Intel Parallel Studio got high marks during beta. >>> http://p.sf.net/sfu/intel-sw-dev >>> _______________________________________________ >>> Matplotlib-users mailing list >>> Mat...@li... >>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >>> > > |
|
From: Jae-Joon L. <lee...@gm...> - 2010-03-05 16:59:03
|
Hi,
It turns out to be a bug (new_vertical works, but new_horizontal does not).
To work around this
right after
cax = divider.new_horizontal(size="5%", pad=0.05, pack_start=True)
add these lines
locator = divider.new_locator(nx=0, ny=0)
cax.set_axes_locator(locator)
These two lines only need to be executed when "new_horizontal" is
called with pack_start=True.
The code below does some monkey patching to fix this bug. Use this if
it fits your need.
Regards,
-JJ
# work around new_horizontal bug
from mpl_toolkits.axes_grid.axes_divider import AxesDivider
if not hasattr(AxesDivider, "_new_horizontal_bug_fixed"):
new_horizontal_orig = AxesDivider.new_horizontal
def new_horizontal(self, size, pad=None, pack_start=False, **kwargs):
ax = new_horizontal_orig(self, size, pad=pad,
pack_start=pack_start, **kwargs)
if pack_start:
locator = self.new_locator(nx=0, ny=0)
ax.set_axes_locator(locator)
return ax
AxesDivider.new_horizontal = new_horizontal
AxesDivider._new_horizontal_bug_fixed = True
On Fri, Mar 5, 2010 at 9:05 AM, Thomas Robitaille
<tho...@gm...> wrote:
> Hi Jae-Joon,
>
> Thanks! This is exactly what I needed. Putting the colorbar on the right or bottom works great - however, I am running into issues with trying to put the colorbar on the left or bottom (which, from my understanding, is controlled by using pack_start=True?). Should the following code work?
>
> import matplotlib.pyplot as mpl
> import numpy as np
> from mpl_toolkits.axes_grid import make_axes_locatable
>
> fig = mpl.figure()
> ax = fig.add_subplot(1,1,1)
> divider = make_axes_locatable(ax)
> cax = divider.new_horizontal(size="5%", pad=0.05, pack_start=True)
> fig.add_axes(cax)
> image = ax.imshow(np.random.random((100,100)))
> cb = fig.colorbar(image, cax=cax)
>
> Cheers,
>
> Thomas
>
> On Mar 4, 2010, at 10:28 PM, Jae-Joon Lee wrote:
>
>> see
>>
>> http://www.mail-archive.com/mat...@li.../msg15919.html
>>
>> axes_grid toolkit provides some helper function that utilizes
>> axes_locator (take a look at demo_locatable_axes_easy function in the
>> example below)
>>
>> http://matplotlib.sourceforge.net/examples/axes_grid/demo_axes_divider.html
>>
>> -JJ
>>
>>
>>
>>
>> On Thu, Mar 4, 2010 at 9:05 PM, Thomas Robitaille
>> <tho...@gm...> wrote:
>>> Hi,
>>>
>>> I am trying to set up a colorbar that automatically resizes if I zoom in to an image (which changes the aspect ratio of the axes, so I want the colorbar to get resized too). Let's say I have two Axes instances, say ax (for the main image) and cax (for the colorbar). I can set up a callback if the view limits in one axes change, for example
>>>
>>> ax.callbacks.connect('xlim_changed', update_colorbar)
>>> ax.callbacks.connect('ylim_changed', update_colorbar)
>>>
>>> Now I can store a reference to cax inside ax:
>>>
>>> ax._cax = cax
>>>
>>> And I can now define update_colorbar so that it basically changes the position of cax:
>>>
>>> def update_colorbar(ax):
>>>
>>> # Get current position
>>> xmin = ax..get_position().xmin
>>> ...
>>>
>>> # Compute new colorbar position
>>> ...
>>>
>>> # Set new position
>>> ax._cax.set_position(...)
>>>
>>> # Return axes instance
>>> return ax
>>>
>>> Now the issue is that if I select a region of the image to zoom into, then as soon as I've selected the region, update_colorbar gets called, but by then, the aspect ratio of ax hasn't changed, and so the position I find when I do xmin = ax..get_position().xmin in update_colorbar is the *old* position of ax, not the new one. So the colorbar position is always one step behind compared to the main image axes.
>>>
>>> Can anyone think of any way that would avoid this issue, and to be able to use the *new* position of ax inside update_colorbar?
>>>
>>> Thanks in advance for any help,
>>>
>>> Thomas
>>> ------------------------------------------------------------------------------
>>> Download Intel® Parallel Studio Eval
>>> Try the new software tools for yourself. Speed compiling, find bugs
>>> proactively, and fine-tune applications for parallel performance.
>>> See why Intel Parallel Studio got high marks during beta.
>>> http://p.sf.net/sfu/intel-sw-dev
>>> _______________________________________________
>>> Matplotlib-users mailing list
>>> Mat...@li...
>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>>
>
>
|
|
From: Thomas R. <tho...@gm...> - 2010-03-05 14:38:17
|
Hi Jae-Joon,
I am encountering another issue, when using the method you suggest in combination with the parasite_axes from the matplotlib toolkit:
---
import matplotlib.pyplot as mpl
import numpy as np
from mpl_toolkits.axes_grid import make_axes_locatable
import mpl_toolkits.axes_grid.parasite_axes as mpltk
fig = mpl.figure()
ax = mpltk.SubplotHost(fig, 1, 1, 1)
fig.add_axes(ax)
divider = make_axes_locatable(ax)
cax = divider.new_horizontal(size="5%", pad=0.05)
fig.add_axes(cax)
image = ax.imshow(np.random.random((100,100)))
cb = fig.colorbar(image, cax=cax)
---
In the above case, the labels end up on the wrong side of the plot, and the usual method for changing the label position, e.g.:
for tick in cax.xaxis.get_major_ticks():
tick.tick1On = True
tick.tick2On = True
tick.label1On = False
tick.label2On = True
does not work. Do you have any idea why this might be?
Thanks for any help,
Thomas
On Mar 4, 2010, at 10:28 PM, Jae-Joon Lee wrote:
> see
>
> http://www.mail-archive.com/mat...@li.../msg15919.html
>
> axes_grid toolkit provides some helper function that utilizes
> axes_locator (take a look at demo_locatable_axes_easy function in the
> example below)
>
> http://matplotlib.sourceforge.net/examples/axes_grid/demo_axes_divider.html
>
> -JJ
>
>
>
>
> On Thu, Mar 4, 2010 at 9:05 PM, Thomas Robitaille
> <tho...@gm...> wrote:
>> Hi,
>>
>> I am trying to set up a colorbar that automatically resizes if I zoom in to an image (which changes the aspect ratio of the axes, so I want the colorbar to get resized too). Let's say I have two Axes instances, say ax (for the main image) and cax (for the colorbar). I can set up a callback if the view limits in one axes change, for example
>>
>> ax.callbacks.connect('xlim_changed', update_colorbar)
>> ax.callbacks.connect('ylim_changed', update_colorbar)
>>
>> Now I can store a reference to cax inside ax:
>>
>> ax._cax = cax
>>
>> And I can now define update_colorbar so that it basically changes the position of cax:
>>
>> def update_colorbar(ax):
>>
>> # Get current position
>> xmin = ax..get_position().xmin
>> ...
>>
>> # Compute new colorbar position
>> ...
>>
>> # Set new position
>> ax._cax.set_position(...)
>>
>> # Return axes instance
>> return ax
>>
>> Now the issue is that if I select a region of the image to zoom into, then as soon as I've selected the region, update_colorbar gets called, but by then, the aspect ratio of ax hasn't changed, and so the position I find when I do xmin = ax..get_position().xmin in update_colorbar is the *old* position of ax, not the new one. So the colorbar position is always one step behind compared to the main image axes.
>>
>> Can anyone think of any way that would avoid this issue, and to be able to use the *new* position of ax inside update_colorbar?
>>
>> Thanks in advance for any help,
>>
>> Thomas
>> ------------------------------------------------------------------------------
>> Download Intel® Parallel Studio Eval
>> Try the new software tools for yourself. Speed compiling, find bugs
>> proactively, and fine-tune applications for parallel performance.
>> See why Intel Parallel Studio got high marks during beta.
>> http://p.sf.net/sfu/intel-sw-dev
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
|
|
From: Thomas R. <tho...@gm...> - 2010-03-05 14:05:43
|
Hi Jae-Joon, Thanks! This is exactly what I needed. Putting the colorbar on the right or bottom works great - however, I am running into issues with trying to put the colorbar on the left or bottom (which, from my understanding, is controlled by using pack_start=True?). Should the following code work? import matplotlib.pyplot as mpl import numpy as np from mpl_toolkits.axes_grid import make_axes_locatable fig = mpl.figure() ax = fig.add_subplot(1,1,1) divider = make_axes_locatable(ax) cax = divider.new_horizontal(size="5%", pad=0.05, pack_start=True) fig.add_axes(cax) image = ax.imshow(np.random.random((100,100))) cb = fig.colorbar(image, cax=cax) Cheers, Thomas On Mar 4, 2010, at 10:28 PM, Jae-Joon Lee wrote: > see > > http://www.mail-archive.com/mat...@li.../msg15919.html > > axes_grid toolkit provides some helper function that utilizes > axes_locator (take a look at demo_locatable_axes_easy function in the > example below) > > http://matplotlib.sourceforge.net/examples/axes_grid/demo_axes_divider.html > > -JJ > > > > > On Thu, Mar 4, 2010 at 9:05 PM, Thomas Robitaille > <tho...@gm...> wrote: >> Hi, >> >> I am trying to set up a colorbar that automatically resizes if I zoom in to an image (which changes the aspect ratio of the axes, so I want the colorbar to get resized too). Let's say I have two Axes instances, say ax (for the main image) and cax (for the colorbar). I can set up a callback if the view limits in one axes change, for example >> >> ax.callbacks.connect('xlim_changed', update_colorbar) >> ax.callbacks.connect('ylim_changed', update_colorbar) >> >> Now I can store a reference to cax inside ax: >> >> ax._cax = cax >> >> And I can now define update_colorbar so that it basically changes the position of cax: >> >> def update_colorbar(ax): >> >> # Get current position >> xmin = ax..get_position().xmin >> ... >> >> # Compute new colorbar position >> ... >> >> # Set new position >> ax._cax.set_position(...) >> >> # Return axes instance >> return ax >> >> Now the issue is that if I select a region of the image to zoom into, then as soon as I've selected the region, update_colorbar gets called, but by then, the aspect ratio of ax hasn't changed, and so the position I find when I do xmin = ax..get_position().xmin in update_colorbar is the *old* position of ax, not the new one. So the colorbar position is always one step behind compared to the main image axes. >> >> Can anyone think of any way that would avoid this issue, and to be able to use the *new* position of ax inside update_colorbar? >> >> Thanks in advance for any help, >> >> Thomas >> ------------------------------------------------------------------------------ >> Download Intel® Parallel Studio Eval >> Try the new software tools for yourself. Speed compiling, find bugs >> proactively, and fine-tune applications for parallel performance. >> See why Intel Parallel Studio got high marks during beta. >> http://p.sf.net/sfu/intel-sw-dev >> _______________________________________________ >> Matplotlib-users mailing list >> Mat...@li... >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >> |
|
From: David G. <d_l...@ya...> - 2010-03-05 04:14:21
|
Hi, folks! Let's see, first the tech stuff: Python version - 2.5.4; matplotlib version - 0.99.0; numpy version - 1.4.0; Platform: 32 bit Windows Vista Home Premium SP2.
OK, now for the problem: imshow is (indirectly) raising "ValueError: zero-size array to ufunc.reduce without identity." Here's the traceback:
Traceback (most recent call last):
File "<mycode>", line 108, in <module>
ax.imshow(part2plot, cmap_name, extent = extent)
File "C:\Python254\lib\site-packages\matplotlib\axes.py", line 6261, in imshow
im.autoscale_None()
File "C:\Python254\lib\site-packages\matplotlib\cm.py", line 236, in autoscale_None
self.norm.autoscale_None(self._A)
File "C:\Python254\lib\site-packages\matplotlib\colors.py", line 792, in autoscale_None
if self.vmin is None: self.vmin = ma.minimum(A)
File "C:\Python254\Lib\site-packages\numpy\ma\core.py", line 5555, in __call__
return self.reduce(a)
File "C:\Python254\Lib\site-packages\numpy\ma\core.py", line 5570, in reduce
t = self.ufunc.reduce(target, **kargs)
ValueError: zero-size array to ufunc.reduce without identity
Script terminated.
And here's the "local" code (it may be difficult to generate a self-contained reproducer of the problem, so I'm postponing that 'til it appears absolutely necessary):
ax.hold(True)
for i in range(4):
for j in range(4):
part2plot = argW[j*ny/4:(j+1)*ny/4, i*nx/4:(i+1)*nx/4]
if N.any(N.logical_not(N.isfinite(part2plot))):
print i, j,
print N.argwhere(N.logical_not(N.isfinite(part2plot)))
extent = (i*nx/4, (i+1)*nx/4, (j+1)*ny/4, j*ny/4)
ax.imshow(part2plot, cmap_name, extent = extent)
I added the print statements because Googling the error, I found an indication that if my image array contained any NaN's, that might be the cause; sure enough, I did have some, but I eliminated them, and now nothing gets printed before the exception is raised, so, unless I'm missing something obvious (wouldn't be the first time ;-)) something else is the problem.
Any ideas? Thanks!
DG
|
|
From: David G. <d_l...@ya...> - 2010-03-05 03:47:28
|
Hi, folks! Let's see, first the tech stuff: Python version - 2.5.4; matplotlib version - 0.99.0; numpy version - 1.4.0; Platform: 32 bit Windows Vista Home Premium SP2.
OK, now for the problem: imshow is (indirectly) raising "ValueError: zero-size array to ufunc.reduce without identity." Here's the traceback:
Traceback (most recent call last):
File "<mycode>", line 108, in <module>
ax.imshow(part2plot, cmap_name, extent = extent)
File "C:\Python254\lib\site-packages\matplotlib\axes.py", line 6261, in imshow
im.autoscale_None()
File "C:\Python254\lib\site-packages\matplotlib\cm.py", line 236, in autoscale_None
self.norm.autoscale_None(self._A)
File "C:\Python254\lib\site-packages\matplotlib\colors.py", line 792, in autoscale_None
if self.vmin is None: self.vmin = ma.minimum(A)
File "C:\Python254\Lib\site-packages\numpy\ma\core.py", line 5555, in __call__
return self.reduce(a)
File "C:\Python254\Lib\site-packages\numpy\ma\core.py", line 5570, in reduce
t = self.ufunc.reduce(target, **kargs)
ValueError: zero-size array to ufunc.reduce without identity
Script terminated.
And here's the "local" code (it may be difficult to generate a self-contained reproducer of the problem, so I'm postponing that 'til it appears absolutely necessary):
ax.hold(True)
for i in range(4):
for j in range(4):
part2plot = argW[j*ny/4:(j+1)*ny/4, i*nx/4:(i+1)*nx/4]
if N.any(N.logical_not(N.isfinite(part2plot))):
print i, j,
print N.argwhere(N.logical_not(N.isfinite(part2plot)))
extent = (i*nx/4, (i+1)*nx/4, (j+1)*ny/4, j*ny/4)
ax.imshow(part2plot, cmap_name, extent = extent)
I added the print statements because Googling the error, I found an indication that if my image array contained any NaN's, that might be the cause; sure enough, I did have some, but I eliminated them, and now nothing gets printed before the exception is raised, so, unless I'm missing something obvious (wouldn't be the first time ;-)) something else is the problem.
Any ideas? Thanks!
DG
|
|
From: Jae-Joon L. <lee...@gm...> - 2010-03-05 03:28:43
|
see http://www.mail-archive.com/mat...@li.../msg15919.html axes_grid toolkit provides some helper function that utilizes axes_locator (take a look at demo_locatable_axes_easy function in the example below) http://matplotlib.sourceforge.net/examples/axes_grid/demo_axes_divider.html -JJ On Thu, Mar 4, 2010 at 9:05 PM, Thomas Robitaille <tho...@gm...> wrote: > Hi, > > I am trying to set up a colorbar that automatically resizes if I zoom in to an image (which changes the aspect ratio of the axes, so I want the colorbar to get resized too). Let's say I have two Axes instances, say ax (for the main image) and cax (for the colorbar). I can set up a callback if the view limits in one axes change, for example > > ax.callbacks.connect('xlim_changed', update_colorbar) > ax.callbacks.connect('ylim_changed', update_colorbar) > > Now I can store a reference to cax inside ax: > > ax._cax = cax > > And I can now define update_colorbar so that it basically changes the position of cax: > > def update_colorbar(ax): > > # Get current position > xmin = ax..get_position().xmin > ... > > # Compute new colorbar position > ... > > # Set new position > ax._cax.set_position(...) > > # Return axes instance > return ax > > Now the issue is that if I select a region of the image to zoom into, then as soon as I've selected the region, update_colorbar gets called, but by then, the aspect ratio of ax hasn't changed, and so the position I find when I do xmin = ax..get_position().xmin in update_colorbar is the *old* position of ax, not the new one. So the colorbar position is always one step behind compared to the main image axes. > > Can anyone think of any way that would avoid this issue, and to be able to use the *new* position of ax inside update_colorbar? > > Thanks in advance for any help, > > Thomas > ------------------------------------------------------------------------------ > Download Intel® Parallel Studio Eval > Try the new software tools for yourself. Speed compiling, find bugs > proactively, and fine-tune applications for parallel performance. > See why Intel Parallel Studio got high marks during beta. > http://p.sf.net/sfu/intel-sw-dev > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > |
|
From: David G. <d_l...@ya...> - 2010-03-05 02:54:11
|
Hi, folks! Let's see, first the tech stuff: Python version - 2.5.4; matplotlib version - 0.99.0; numpy version - 1.4.0; Platform: 32 bit Windows Vista Home Premium SP2.
OK, now for the problem: imshow is (indirectly) raising "ValueError: zero-size array to ufunc.reduce without identity." Here's the traceback:
Traceback (most recent call last):
File "<mycode>", line 108, in <module>
ax.imshow(part2plot, cmap_name, extent = extent)
File "C:\Python254\lib\site-packages\matplotlib\axes.py", line 6261, in imshow
im.autoscale_None()
File "C:\Python254\lib\site-packages\matplotlib\cm.py", line 236, in autoscale_None
self.norm.autoscale_None(self._A)
File "C:\Python254\lib\site-packages\matplotlib\colors.py", line 792, in autoscale_None
if self.vmin is None: self.vmin = ma.minimum(A)
File "C:\Python254\Lib\site-packages\numpy\ma\core.py", line 5555, in __call__
return self.reduce(a)
File "C:\Python254\Lib\site-packages\numpy\ma\core.py", line 5570, in reduce
t = self.ufunc.reduce(target, **kargs)
ValueError: zero-size array to ufunc.reduce without identity
Script terminated.
And here's the "local" code (it may be difficult to generate a self-contained reproducer of the problem, so I'm postponing that 'til it appears absolutely necessary):
ax.hold(True)
for i in range(4):
for j in range(4):
part2plot = argW[j*ny/4:(j+1)*ny/4, i*nx/4:(i+1)*nx/4]
if N.any(N.logical_not(N.isfinite(part2plot))):
print i, j,
print N.argwhere(N.logical_not(N.isfinite(part2plot)))
extent = (i*nx/4, (i+1)*nx/4, (j+1)*ny/4, j*ny/4)
ax.imshow(part2plot, cmap_name, extent = extent)
I added the print statements because Googling the error, I found an indication that if my image array contained any NaN's, that might be the cause; sure enough, I did have some, but I eliminated them, and now nothing gets printed before the exception is raised, so, unless I'm missing something obvious (wouldn't be the first time ;-)) something else is the problem.
Any ideas? Thanks!
DG
|
|
From: David G. <d_l...@ya...> - 2010-03-05 02:18:41
|
Hi, folks! Let's see, first the tech stuff: Python version - 2.5.4; matplotlib version - 0.99.0; numpy version - 1.4.0; Platform: 32 bit Windows Vista Home Premium SP2.
OK, now for the problem: imshow is (indirectly) raising "ValueError: zero-size array to ufunc.reduce without identity." Here's the traceback:
Traceback (most recent call last):
File "<mycode>", line 108, in <module>
ax.imshow(part2plot, cmap_name, extent = extent)
File "C:\Python254\lib\site-packages\matplotlib\axes.py", line 6261, in imshow
im.autoscale_None()
File "C:\Python254\lib\site-packages\matplotlib\cm.py", line 236, in autoscale_None
self.norm.autoscale_None(self._A)
File "C:\Python254\lib\site-packages\matplotlib\colors.py", line 792, in autoscale_None
if self.vmin is None: self.vmin = ma.minimum(A)
File "C:\Python254\Lib\site-packages\numpy\ma\core.py", line 5555, in __call__
return self.reduce(a)
File "C:\Python254\Lib\site-packages\numpy\ma\core.py", line 5570, in reduce
t = self.ufunc.reduce(target, **kargs)
ValueError: zero-size array to ufunc.reduce without identity
Script terminated.
And here's the "local" code (it may be difficult to generate a self-contained reproducer of the problem, so I'm postponing that 'til it appears absolutely necessary):
ax.hold(True)
for i in range(4):
for j in range(4):
part2plot = argW[j*ny/4:(j+1)*ny/4, i*nx/4:(i+1)*nx/4]
if N.any(N.logical_not(N.isfinite(part2plot))):
print i, j,
print N.argwhere(N.logical_not(N.isfinite(part2plot)))
extent = (i*nx/4, (i+1)*nx/4, (j+1)*ny/4, j*ny/4)
ax.imshow(part2plot, cmap_name, extent = extent)
I added the print statements because Googling the error, I found an indication that if my image array contained any NaN's, that might be the cause; sure enough, I did have some, but I eliminated them, and now nothing gets printed before the exception is raised, so, unless I'm missing something obvious (wouldn't be the first time ;-)) something else is the problem.
Any ideas? Thanks!
DG
|
|
From: Thomas R. <tho...@gm...> - 2010-03-05 02:06:03
|
Hi,
I am trying to set up a colorbar that automatically resizes if I zoom in to an image (which changes the aspect ratio of the axes, so I want the colorbar to get resized too). Let's say I have two Axes instances, say ax (for the main image) and cax (for the colorbar). I can set up a callback if the view limits in one axes change, for example
ax.callbacks.connect('xlim_changed', update_colorbar)
ax.callbacks.connect('ylim_changed', update_colorbar)
Now I can store a reference to cax inside ax:
ax._cax = cax
And I can now define update_colorbar so that it basically changes the position of cax:
def update_colorbar(ax):
# Get current position
xmin = ax..get_position().xmin
...
# Compute new colorbar position
...
# Set new position
ax._cax.set_position(...)
# Return axes instance
return ax
Now the issue is that if I select a region of the image to zoom into, then as soon as I've selected the region, update_colorbar gets called, but by then, the aspect ratio of ax hasn't changed, and so the position I find when I do xmin = ax..get_position().xmin in update_colorbar is the *old* position of ax, not the new one. So the colorbar position is always one step behind compared to the main image axes.
Can anyone think of any way that would avoid this issue, and to be able to use the *new* position of ax inside update_colorbar?
Thanks in advance for any help,
Thomas
|
|
From: Thomas R. <tho...@gm...> - 2010-03-05 01:55:10
|
Hi,
I would like to change the orientation of a colorbar once it has already been drawn. So for example if I create the colorbar with:
cb = fig.colorbar(mappable=image, cax=cax, orientation='vertical')
I would like to be able to do
cb.set_orientation('horizontal')
Is there a way to do this, since set_orientation does not exist?
Thanks for any help,
Thomas
|
|
From: Jae-Joon L. <lee...@gm...> - 2010-03-04 19:59:38
|
Not sure what exactly you want. Is this close?
ax = subplot(111)
tr = ax.get_xaxis_transform()
ax.plot([0.2, 0.8], [0.5, 0.5],
transform=tr)
The x-coodinate is in data coordinate, but y coordinate is in
(normalized) axes coordinate.
More about the transforms behind matplotlib can be found in
http://matplotlib.sourceforge.net/trunk-docs/users/transforms_tutorial.html
-JJ
On Thu, Mar 4, 2010 at 3:10 AM, Timo Heine <tim...@gm...> wrote:
> Hello,
> I'v made a small program which plots data from a CAN-bus log file. Some of
> the data to plot is logical type on/off values (bit on or off). I have tried
> to find a way to plot this kind of data with no success.
> Basically what I want to do is to draw a horizontal line with relative y
> co-ordinates and absolute xmin and xmax co-ordinate. Then I could draw a
> line when a bit is high and have it always in plot area even when zooming
> etc. Like axhline(...) but with relative y and absolute x
> co-ordinates. Another way to do this could be using subplots, but I can't
> figure out how to use same x-scale on the both plots.
> Any suggestions?
> Best Regards
> Timo
> ------------------------------------------------------------------------------
> Download Intel® Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
|
|
From: Jae-Joon L. <lee...@gm...> - 2010-03-04 19:45:32
|
With axes aspect_ratio set, the position of the axes is determined
during the drawing time. And the position of the inset axes also need
to be adjusted during the drawing time to incorporate this,
One way to archive this is to set axes_locator attribute, which accept
a callable object that returns the position of the axes.
Here is a slightly modified version of your add_inset.
def add_inset(ax,ij):
# Define a composite transform to go from data space in the Axes
# instance to figure coordinates.
# We need to perform a composite transform to get the location:
# data to display followed by display to figure (because axes())
# takes a rect for positions relative to the figure
def my_axes_locator(axes, renderer):
compTrans = ax.transData + ax.get_figure().transFigure.inverted()
width=0.1
height=0.1
x,y = compTrans.transform(ij)
bbox = [x-width/2.,y-height/2.,width,height]
return bbox
# Place a subplot centered on the specified location with a fixed size
# (relative to the size of the figure)
# The green dot we plot here should cover up the red dot on the plot
# underneath this one. We have a problem if they don't align.
ax2 = plt.axes([0,0,1,1],axisbg='none', axes_locator=my_axes_locator)
ax2.plot(0.5,0.5,'go')
ax2.set_xlim((0,1))
ax2.set_ylim((0,1))
return ax2
Regards,
-JJ
On Thu, Mar 4, 2010 at 12:53 PM, Mike Kay <vd...@gm...> wrote:
> Hi list -
>
> I've got a need to add several axes instances (e.g., barplots) to an
> existing figure. These additional axes need to be placed relative to data
> points on that plot.
>
> A problem occurs if the aspect ratio of the parent axes is set to a fixed
> value rather than using 'auto'.
>
> The attached script illustrates the problem with a pair of plots. Both plot
> a single red dot on the parent figure. A subplot is then placed directly on
> top of this point and a single point is plotted there, in green. If all's
> well you shouldn't see the red dot and should just see the green dot. In
> figure 2, where the aspect ratio is fixed, the subplot does not get placed
> at the correct location.
>
> Have I stumbled onto a subtlety of transforms that I'm not accounting for or
> is this perhaps a bug?
>
> matplotlib version 0.99.1 on linux; numpy 1.2.1
>
> thanks a lot,
> -mike
>
> ------------------------------------------------------------------------------
> Download Intel® Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
|
|
From: Friedrich R. <fri...@gm...> - 2010-03-04 18:36:16
|
Do you want something like the attached? I created it with my package that no-one wants :-( >>> import diagram_cl >>> import diagram_cl.kernels.tk >>> import numpy >>> import Tkinter >>> d1 = diagram_cl.Diagram() >>> series = (numpy.random.random(100) > 0.5).astype(numpy.float) >>> for idx in xrange(0, len(series)): ... layer = diagram_cl.Layer2D(x = [0, series[idx]], y = [idx, idx], color = 'blue') ... d1.add_layer(layer) ... >>> tk = Tkinter.Tk() >>> k1 = diagram_cl.kernels.tk.Diagram(tk, d1) Double-right click on the figure, "Save", 200x200, "Bits.png". But of course, you can also do it with normal matplotlib (I'm not used to the pyplot things though, I'm rather using purist's API): Hmm, that's why it would be not the standard way to do it, so can anyone else post pure matplotlib means? Friedrich |
|
From: Jeff W. <js...@fa...> - 2010-03-04 18:03:48
|
Jim Vickroy wrote: > Hi, > > I have been unable to place a colorbar on the LEFT side of a figure. > For example, in the Gaussian noise with vertical colorbar > <http://matplotlib.sourceforge.net/examples/pylab_examples/colorbar_tick_labelling_demo.html> > demo, how can the colorbar be positioned on the left side of the figure. > > Thanks, > -- jv > Create your own axes instance for the colorbar (as in http://matplotlib.sourceforge.net/examples/pylab_examples/multi_image.html). -Jeff -- Jeffrey S. Whitaker Phone : (303)497-6313 Meteorologist FAX : (303)497-6449 NOAA/OAR/PSD R/PSD1 Email : Jef...@no... 325 Broadway Office : Skaggs Research Cntr 1D-113 Boulder, CO, USA 80303-3328 Web : http://tinyurl.com/5telg |
|
From: Jim V. <Jim...@no...> - 2010-03-04 17:58:43
|
Hi, I have been unable to place a colorbar on the LEFT side of a figure. For example, in the Gaussian noise with vertical colorbar <http://matplotlib.sourceforge.net/examples/pylab_examples/colorbar_tick_labelling_demo.html> demo, how can the colorbar be positioned on the left side of the figure. Thanks, -- jv |
|
From: kamaleon <fra...@ya...> - 2010-03-04 17:58:21
|
Thanks you put it right,
I wanted to know how to remove them inside the subplot. It is done.
Cheers
Matthias Michler wrote:
>
> On Thursday 04 March 2010 17:11:54 kamaleon wrote:
>> Thanks Matthias, this seems help me.
>> But how to remove the xlabel, ylable and the tilte in the subplot?
>> Cheers
>>
>> Matthias Michler wrote:
>> > On Thursday 04 March 2010 13:35:12 kamaleon wrote:
> [...]
>
> Hi ,
>
> what do you mean by xlabel, ylabel and title?
> In my example these were not set. In case you set them, you can remove
> them
> using
> xlabel('')
> ylabel('')
> title('')
>
> or do you mean the ticks and tick-labels on the axes?
> These can be removed using
>
> xticks([ ])
> ytick([ ])
>
> Kind regards,
> Matthias
>
> ------------------------------------------------------------------------------
> Download Intel® Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
--
View this message in context: http://old.nabble.com/how-to-insert-a-part-of-a-plot-in-the-same-figure-tp27780169p27784306.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
|
|
From: Mike K. <vd...@gm...> - 2010-03-04 17:53:21
|
Hi list - I've got a need to add several axes instances (e.g., barplots) to an existing figure. These additional axes need to be placed relative to data points on that plot. A problem occurs if the aspect ratio of the parent axes is set to a fixed value rather than using 'auto'. The attached script illustrates the problem with a pair of plots. Both plot a single red dot on the parent figure. A subplot is then placed directly on top of this point and a single point is plotted there, in green. If all's well you shouldn't see the red dot and should just see the green dot. In figure 2, where the aspect ratio is fixed, the subplot does not get placed at the correct location. Have I stumbled onto a subtlety of transforms that I'm not accounting for or is this perhaps a bug? matplotlib version 0.99.1 on linux; numpy 1.2.1 thanks a lot, -mike |