SourceForge logo
SourceForge logo
Menu

matplotlib-users — Discussion related to using matplotlib

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
(31)
3
(17)
4
(18)
5
(7)
6
(5)
7
(16)
8
(9)
9
(19)
10
(18)
11
(17)
12
(7)
13
(6)
14
(15)
15
(16)
16
(15)
17
(19)
18
(27)
19
(10)
20
(5)
21
(5)
22
(19)
23
(7)
24
(11)
25
(19)
26
(1)
27
(36)
28
(37)
29
(28)
30
(36)



Showing results of 480

<< < 1 2 3 4 5 6 .. 20 > >> (Page 4 of 20)
From: Michael D. <md...@st...> - 2009年09月28日 20:57:12
Attachments: custom_box.py
Is the attached sort of what you want? It defines a custom rectangle by 
(x, w, y1, y2) and overrides the get_transform of the patch to update 
itself at draw time.
Mike
Uri Laserson wrote:
> On Mon, Sep 28, 2009 at 16:03, Michael Droettboom <md...@st...> wrote:
> 
>> If I understand correctly, the top and bottom of the box are in data
>> coordinates, the x-center of the box is in data coordinates, only the width
>> of the box is in axes coordinates. Is that correct? If so, a
>> 
>
> That's exactly correct.
>
> 
>> PolyCollection won't be able to do this (directly), since that would require
>> both the width and height to be in axes coordinates.
>> 
>
> In principle, could you use a blended tranform for that? Eitherway, I
> don't think it would work, because the patch objects would be drawn to
> specific Axes coords. If the scale is changed (e.g, by switching to
> log scale), then what would prompt the Axes coords to be recalculated?
> I was thinking earlier that I could compose the transData and
> transAxes.inverse transforms to recalculate where the new Axes coord
> should be, but Mike thought this approach would fail (though I'm still
> not exactly sure why, no doubt because of my own ignorance).
>
> Uri
>
> 
>> Mike
>>
>> Eric Firing wrote:
>> 
>>> Uri Laserson wrote:
>>>
>>> 
>>>> Is it possible to specify a path object that will use different
>>>> transforms for different vertices?
>>>>
>>>> This is again related to plotting a box whose height is specified by
>>>> data coords, but whose width is a constant in axes coords regardless
>>>> of scale (so linear and log x-scales would produce a box of the same
>>>> width).
>>>>
>>>> Ideally, I would draw a path like this:
>>>> 1. the center of the box would be located at x and bottom and top
>>>> would be y1, y2, all in data coords
>>>> 2. I would move to (x,y1) at the bottom-center of the box.
>>>> 3. The x value would now need to be converted to Axes coords, possibly
>>>> by applying transData + transAxes.inverted
>>>> 4. I would want to draw a line to (x-0.1, y1) where x is now in axes
>>>> coords and y is still in data coords. Then up, then right, then down,
>>>> and then close the polygon.
>>>>
>>>> How do I implement this?
>>>>
>>>> 
>>> I must be missing something, because I still don't see why you can't do
>>> all this very simply by using a PolyCollection, with the vertices in axes
>>> coordinates and the offset in data coordinates.
>>>
>>> Eric
>>>
>>>
>>> 
>>>> As I mentioned before, a blended transform would allow me to make the
>>>> moves i am interested in. However, a change of scale would change the
>>>> correspondence between data and axes coords, so the axes transform
>>>> part of the blended axes would have to be recomputed everytime the
>>>> scale changes based on where the (x,y1) point lands in the axes. Is
>>>> this correct?
>>>>
>>>> Any suggestions are welcome...thanks!
>>>>
>>>> Uri
>>>>
>>>>
>>>>
>>>> 
>>>
>>> ------------------------------------------------------------------------------
>>> Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
>>> is the only developer event you need to attend this year. Jumpstart your
>>> developing skills, take BlackBerry mobile applications to market and stay
>>> ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
>>> http://p.sf.net/sfu/devconf
>>> _______________________________________________
>>> Matplotlib-users mailing list
>>> Mat...@li...
>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>>
>>> 
>> --
>> Michael Droettboom
>> Science Software Branch
>> Operations and Engineering Division
>> Space Telescope Science Institute
>> Operated by AURA for NASA
>>
>>
>> 
>
>
>
> 
-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA
From: Jae-Joon L. <lee...@gm...> - 2009年09月28日 20:53:34
On Mon, Sep 28, 2009 at 4:15 PM, Uri Laserson <las...@mi...> wrote:
> On Mon, Sep 28, 2009 at 16:03, Michael Droettboom <md...@st...> wrote:
>> If I understand correctly, the top and bottom of the box are in data
>> coordinates, the x-center of the box is in data coordinates, only the width
>> of the box is in axes coordinates. Is that correct? If so, a
>
> That's exactly correct.
>
I personally think that a box, whose height has a physical meaning (in
data coordinate) while its width does not, is not a good
representation of your data. A vertical line or something like
errorbar seems to be more suitable to me.
>> PolyCollection won't be able to do this (directly), since that would require
>> both the width and height to be in axes coordinates.
>
> In principle, could you use a blended tranform for that? Eitherway, I
> don't think it would work, because the patch objects would be drawn to
> specific Axes coords. If the scale is changed (e.g, by switching to
> log scale), then what would prompt the Axes coords to be recalculated?
> I was thinking earlier that I could compose the transData and
> transAxes.inverse transforms to recalculate where the new Axes coord
> should be, but Mike thought this approach would fail (though I'm still
> not exactly sure why, no doubt because of my own ignorance).
>
As Mike has explained, the transform trick (blended or not) won't
work. The width and y-center will be always transformed with the same
transform, which is not what you want. I think you need to create a
custom patch class for this to work. One option seems to subclass the
Rectangle class and overide the _update_patch_transform method. The
patch transform is used to transform a unit rectangle to a rectangle
in data coordinate (or whatever coordinate the patch uses), i.e., you
need to calculate the coordinate of the box in the data coordinate(or
whatever coordinate the patch uses).
-JJ
> Uri
>
>>
>> Mike
>>
>> Eric Firing wrote:
>>>
>>> Uri Laserson wrote:
>>>
>>>>
>>>> Is it possible to specify a path object that will use different
>>>> transforms for different vertices?
>>>>
>>>> This is again related to plotting a box whose height is specified by
>>>> data coords, but whose width is a constant in axes coords regardless
>>>> of scale (so linear and log x-scales would produce a box of the same
>>>> width).
>>>>
>>>> Ideally, I would draw a path like this:
>>>> 1. the center of the box would be located at x and bottom and top
>>>> would be y1, y2, all in data coords
>>>> 2. I would move to (x,y1) at the bottom-center of the box.
>>>> 3. The x value would now need to be converted to Axes coords, possibly
>>>> by applying transData + transAxes.inverted
>>>> 4. I would want to draw a line to (x-0.1, y1) where x is now in axes
>>>> coords and y is still in data coords. Then up, then right, then down,
>>>> and then close the polygon.
>>>>
>>>> How do I implement this?
>>>>
>>>
>>> I must be missing something, because I still don't see why you can't do
>>> all this very simply by using a PolyCollection, with the vertices in axes
>>> coordinates and the offset in data coordinates.
>>>
>>> Eric
>>>
>>>
>>>>
>>>> As I mentioned before, a blended transform would allow me to make the
>>>> moves i am interested in. However, a change of scale would change the
>>>> correspondence between data and axes coords, so the axes transform
>>>> part of the blended axes would have to be recomputed everytime the
>>>> scale changes based on where the (x,y1) point lands in the axes. Is
>>>> this correct?
>>>>
>>>> Any suggestions are welcome...thanks!
>>>>
>>>> Uri
>>>>
>>>>
>>>>
>>>
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
>>> is the only developer event you need to attend this year. Jumpstart your
>>> developing skills, take BlackBerry mobile applications to market and stay
>>> ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
>>> http://p.sf.net/sfu/devconf
>>> _______________________________________________
>>> Matplotlib-users mailing list
>>> Mat...@li...
>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>>
>>
>> --
>> Michael Droettboom
>> Science Software Branch
>> Operations and Engineering Division
>> Space Telescope Science Institute
>> Operated by AURA for NASA
>>
>>
>
>
>
> --
> Uri Laserson
> PhD Candidate, Biomedical Engineering
> Harvard Medical School (Genetics)
> Massachusetts Institute of Technology (Mathematics)
> phone +1 917 742 8019
> las...@mi...
>
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart your
> developing skills, take BlackBerry mobile applications to market and stay
> ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
> http://p.sf.net/sfu/devconf
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: Uri L. <las...@mi...> - 2009年09月28日 20:15:46
On Mon, Sep 28, 2009 at 16:03, Michael Droettboom <md...@st...> wrote:
> If I understand correctly, the top and bottom of the box are in data
> coordinates, the x-center of the box is in data coordinates, only the width
> of the box is in axes coordinates. Is that correct? If so, a
That's exactly correct.
> PolyCollection won't be able to do this (directly), since that would require
> both the width and height to be in axes coordinates.
In principle, could you use a blended tranform for that? Eitherway, I
don't think it would work, because the patch objects would be drawn to
specific Axes coords. If the scale is changed (e.g, by switching to
log scale), then what would prompt the Axes coords to be recalculated?
 I was thinking earlier that I could compose the transData and
transAxes.inverse transforms to recalculate where the new Axes coord
should be, but Mike thought this approach would fail (though I'm still
not exactly sure why, no doubt because of my own ignorance).
Uri
>
> Mike
>
> Eric Firing wrote:
>>
>> Uri Laserson wrote:
>>
>>>
>>> Is it possible to specify a path object that will use different
>>> transforms for different vertices?
>>>
>>> This is again related to plotting a box whose height is specified by
>>> data coords, but whose width is a constant in axes coords regardless
>>> of scale (so linear and log x-scales would produce a box of the same
>>> width).
>>>
>>> Ideally, I would draw a path like this:
>>> 1. the center of the box would be located at x and bottom and top
>>> would be y1, y2, all in data coords
>>> 2. I would move to (x,y1) at the bottom-center of the box.
>>> 3. The x value would now need to be converted to Axes coords, possibly
>>> by applying transData + transAxes.inverted
>>> 4. I would want to draw a line to (x-0.1, y1) where x is now in axes
>>> coords and y is still in data coords. Then up, then right, then down,
>>> and then close the polygon.
>>>
>>> How do I implement this?
>>>
>>
>> I must be missing something, because I still don't see why you can't do
>> all this very simply by using a PolyCollection, with the vertices in axes
>> coordinates and the offset in data coordinates.
>>
>> Eric
>>
>>
>>>
>>> As I mentioned before, a blended transform would allow me to make the
>>> moves i am interested in. However, a change of scale would change the
>>> correspondence between data and axes coords, so the axes transform
>>> part of the blended axes would have to be recomputed everytime the
>>> scale changes based on where the (x,y1) point lands in the axes. Is
>>> this correct?
>>>
>>> Any suggestions are welcome...thanks!
>>>
>>> Uri
>>>
>>>
>>>
>>
>>
>>
>> ------------------------------------------------------------------------------
>> Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
>> is the only developer event you need to attend this year. Jumpstart your
>> developing skills, take BlackBerry mobile applications to market and stay
>> ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
>> http://p.sf.net/sfu/devconf
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>
> --
> Michael Droettboom
> Science Software Branch
> Operations and Engineering Division
> Space Telescope Science Institute
> Operated by AURA for NASA
>
>
-- 
Uri Laserson
PhD Candidate, Biomedical Engineering
Harvard Medical School (Genetics)
Massachusetts Institute of Technology (Mathematics)
phone +1 917 742 8019
las...@mi...
From: Michael D. <md...@st...> - 2009年09月28日 20:04:04
If I understand correctly, the top and bottom of the box are in data 
coordinates, the x-center of the box is in data coordinates, only the 
width of the box is in axes coordinates. Is that correct? If so, a 
PolyCollection won't be able to do this (directly), since that would 
require both the width and height to be in axes coordinates.
Mike
Eric Firing wrote:
> Uri Laserson wrote:
> 
>> Is it possible to specify a path object that will use different
>> transforms for different vertices?
>>
>> This is again related to plotting a box whose height is specified by
>> data coords, but whose width is a constant in axes coords regardless
>> of scale (so linear and log x-scales would produce a box of the same
>> width).
>>
>> Ideally, I would draw a path like this:
>> 1. the center of the box would be located at x and bottom and top
>> would be y1, y2, all in data coords
>> 2. I would move to (x,y1) at the bottom-center of the box.
>> 3. The x value would now need to be converted to Axes coords, possibly
>> by applying transData + transAxes.inverted
>> 4. I would want to draw a line to (x-0.1, y1) where x is now in axes
>> coords and y is still in data coords. Then up, then right, then down,
>> and then close the polygon.
>>
>> How do I implement this?
>> 
>
> I must be missing something, because I still don't see why you can't do 
> all this very simply by using a PolyCollection, with the vertices in 
> axes coordinates and the offset in data coordinates.
>
> Eric
>
> 
>> As I mentioned before, a blended transform would allow me to make the
>> moves i am interested in. However, a change of scale would change the
>> correspondence between data and axes coords, so the axes transform
>> part of the blended axes would have to be recomputed everytime the
>> scale changes based on where the (x,y1) point lands in the axes. Is
>> this correct?
>>
>> Any suggestions are welcome...thanks!
>>
>> Uri
>>
>>
>> 
>
>
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart your
> developing skills, take BlackBerry mobile applications to market and stay 
> ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
> http://p.sf.net/sfu/devconf
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA
From: Eric F. <ef...@ha...> - 2009年09月28日 19:15:44
Matthias Michler wrote:
> Hi Ralph,
> 
> I don't think there exists a function like the line-'set_data'-method for 
> collections, which are generated by 'contour'. This particular method of 
> lines only changes the data but leave anything else unchanged.
> I attached an easy approach of updating a contour plot (simply deleting old 
> collections), but I'm not sure that this is the best solution.
I don't think you area gaining anything at all by manually deleting the 
collections. Better to just clear the axes, or clear the figure, and 
make a fresh plot.
Eric
> 
> Kind regards,
> Matthias
> 
> On Monday 28 September 2009 13:52:42 Ralph Kube wrote:
>> Hi,
>> is there a way to update a contour plot? I need to display a series of
>> contour plots from a directory with data files and want to view them
>> consecutively, preferrably without building a gui for it. Is there an
>> easy way out?
>>
>> Cheers, Ralph
> 
> 
> ------------------------------------------------------------------------
> 
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart your
> developing skills, take BlackBerry mobile applications to market and stay 
> ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
> http://p.sf.net/sfu/devconf
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Eric F. <ef...@ha...> - 2009年09月28日 19:04:53
Uri Laserson wrote:
> Is it possible to specify a path object that will use different
> transforms for different vertices?
> 
> This is again related to plotting a box whose height is specified by
> data coords, but whose width is a constant in axes coords regardless
> of scale (so linear and log x-scales would produce a box of the same
> width).
> 
> Ideally, I would draw a path like this:
> 1. the center of the box would be located at x and bottom and top
> would be y1, y2, all in data coords
> 2. I would move to (x,y1) at the bottom-center of the box.
> 3. The x value would now need to be converted to Axes coords, possibly
> by applying transData + transAxes.inverted
> 4. I would want to draw a line to (x-0.1, y1) where x is now in axes
> coords and y is still in data coords. Then up, then right, then down,
> and then close the polygon.
> 
> How do I implement this?
I must be missing something, because I still don't see why you can't do 
all this very simply by using a PolyCollection, with the vertices in 
axes coordinates and the offset in data coordinates.
Eric
> 
> As I mentioned before, a blended transform would allow me to make the
> moves i am interested in. However, a change of scale would change the
> correspondence between data and axes coords, so the axes transform
> part of the blended axes would have to be recomputed everytime the
> scale changes based on where the (x,y1) point lands in the axes. Is
> this correct?
> 
> Any suggestions are welcome...thanks!
> 
> Uri
> 
> 
From: Michael D. <md...@st...> - 2009年09月28日 18:04:20
I don't think the transformations framework is going to be of much help 
for automating this. You seem to be suggesting an x-axis where the 
center is in data coords and the width is in axes coords. Once you've 
added the two together, it will be impossible to separate them.
I think the path of least resistance will be for you to create a new 
artist class and override the draw method, such that you can do all the 
necessary calculations based on the current values of the axes and data 
transforms on every draw.
There's an example of creating a custom artist in 
api/line_with_text.py... Then it's just writing a draw method to do 
what you need to do -- you should be able to get at the axes 
transformations through self.axes.transAxes and self.axes.transData. 
I'm a bit busy today to really work that through, but hopefully that's 
enough to get you started.
Mike
Uri Laserson wrote:
> Is it possible to specify a path object that will use different
> transforms for different vertices?
>
> This is again related to plotting a box whose height is specified by
> data coords, but whose width is a constant in axes coords regardless
> of scale (so linear and log x-scales would produce a box of the same
> width).
>
> Ideally, I would draw a path like this:
> 1. the center of the box would be located at x and bottom and top
> would be y1, y2, all in data coords
> 2. I would move to (x,y1) at the bottom-center of the box.
> 3. The x value would now need to be converted to Axes coords, possibly
> by applying transData + transAxes.inverted
> 4. I would want to draw a line to (x-0.1, y1) where x is now in axes
> coords and y is still in data coords. Then up, then right, then down,
> and then close the polygon.
>
> How do I implement this?
>
> As I mentioned before, a blended transform would allow me to make the
> moves i am interested in. However, a change of scale would change the
> correspondence between data and axes coords, so the axes transform
> part of the blended axes would have to be recomputed everytime the
> scale changes based on where the (x,y1) point lands in the axes. Is
> this correct?
>
> Any suggestions are welcome...thanks!
>
> Uri
>
>
> 
-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA
From: John [H2O] <was...@gm...> - 2009年09月28日 17:26:07
I'm trying to 'automate' a few components within basemap. I have a pretty
complicated, and assuredly poorly written, set of functions that allow me to
'dynamically' plot a grid of data (lon,lat).
Here is one section where I try to deal with transforming the data based on
the projection. 'data' is a grid, often of size 720x360 or 720x180,
representing full globe or hemisphere at 0.5 degree resolution. 'outlon0',
outlat0', and 'd*out' are the llcrnr coordinates and step. 'transform' is an
option, that is set to True by default:
1680 ## set up transformations for the data array 
1681 if m.projection not in ['cyl','merc','mill']:
1682 lats = np.arange( outlat0, ( outlat0 + ( numygrid*dyout ) ),
dyout )[:-1]
1683 lons = np.arange( outlon0, ( outlon0 + ( numxgrid*dxout ) ),
dxout )[:-1]
1684 data = data[:-1,:-1]
1685 else:
1686 lats = np.arange( outlat0, ( outlat0 + ( numygrid*dyout ) ),
dyout )
1687 lons = np.arange( outlon0, ( outlon0 + ( numxgrid*dxout ) ),
dxout )
1688 
1689 ## transform to nx x ny regularly spaced native projection grid
1690 if transform:
1691 dx = 2.*np.pi*m.rmajor/len(lons)
1692 nx = int((m.xmax-m.xmin)/dx)+1; ny = int((m.ymax-m.ymin)/dx)+1
1693 if nx is 1:
1694 topodat = data
1695 else:
1696 topodat = m.transform_scalar(data,lons,lats,nx,ny)
1697 else:
1698 topodat = data
The problem is, when I use the approach with a 'cyl' grid, then subsequently
try to draw the lsmask, I get a failure. Is this approach incorrect? I had
to use the if nx is 1 statement because it was crashing with zero division
error in some cases.
Thanks.
-- 
View this message in context: http://www.nabble.com/basemap%2C-transform_scalar-question-tp25649437p25649437.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Gökhan S. <gok...@gm...> - 2009年09月28日 17:00:05
There is
On Sun, Sep 27, 2009 at 8:49 PM, Gökhan Sever <gok...@gm...> wrote:
>
>
> On Sun, Sep 27, 2009 at 7:44 PM, Jae-Joon Lee <lee...@gm...>wrote:
>
>> On Sun, Sep 27, 2009 at 4:18 PM, Gökhan Sever <gok...@gm...>
>> wrote:
>> > When I run this as it is, and zoom once the top x-axis ticklabels
>> disappear:
>> > http://img2.imageshack.us/img2/5493/zoom1.png
>> >
>> > After commenting these three lines:
>> >
>> > #locator = MinuteLocator(interval=1)
>> > #locator = SecondLocator(interval=30)
>> > #par2.xaxis.set_major_locator(locator)
>> >
>> > and running I get somewhat nice view after zooms:
>> > http://img340.imageshack.us/img340/6632/zoom2.png
>> >
>> > with a minute discrepancy; resulting with shifts on the top x-labels.
>> >
>> > Any last thoughts?
>> >
>>
>> I believe that this is due to wrong tick locations. As you easily
>> guess, the default tick locators are not suitable for datetime ticks
>> and this is why we have separate locators. Please take a look at
>> documentations.
>>
>> http://matplotlib.sourceforge.net/api/dates_api.html
>>
>> If you want to have locator that works for several zoom levels, you
>> may try AutoDateLocator.
>>
>>
>> from matplotlib.dates import DateFormatter, MinuteLocator,
>> SecondLocator, AutoDateLocator, AutoDateFormatter
>> locator = AutoDateLocator()
>> par2.xaxis.set_major_locator(locator)
>> formatter=AutoDateFormatter(locator)
>> par2.xaxis.set_major_formatter(formatter)
>>
>> par2.axis["top"].major_ticklabels.set(rotation=30,
>> ha="left",
>> va="bottom")
>>
>>
>> While the AutoLocator seems to give too may ticks in my opinion, I
>> think this is as far as I can help.
>>
>> Regards,
>>
>> -JJ
>>
>
> Yep, thanks. That gives so many ticks indeed. Would be nicer to see labels
> in every other tick.
>
> This said,
>
> locator = SecondLocator(interval=20)
> par2.xaxis.set_major_locator(locator)
> par2.xaxis.set_major_formatter(DateFormatter('%H:%M:%S'))
>
> satisfies my initial thoughts. With some pan and zoom I can achieve what I
> want.
>
> Attaching the final modified file. I think this is a good demonstrative
> example. It is up to you further put the script into the axes_grid examples.
>
> Thanks again for your efforts.
>
>
>
There is still issues with this approach. First and foremost it is very slow
when the arrays plotted are big (in my case ~8000 points.)
AutoDateLocator() works fast, however on some zoomings the top axis is
filled with labels. This needs to be addressed.
Could anyone help me to see the flow of the AutoDateLocator() class'
updates? It only behaves weird on some certain zooms, put how is this
updated on the screen is a mystery to me so far. I have Eclipse + PyDev, but
don't know where should I set the breakpoints to analyse this behaviour?
Thanks.
>
>
>
>>
>>
>> > On Sun, Sep 27, 2009 at 2:12 PM, Jae-Joon Lee <lee...@gm...>
>> wrote:
>> >>
>> >> Here it is.
>> >>
>> >> -JJ
>> >>
>> >> On Sun, Sep 27, 2009 at 3:09 PM, Gökhan Sever <gok...@gm...>
>> >> wrote:
>> >> > JJ,
>> >> >
>> >> > Could you please re-attach the code? Apparently, it has been
>> forgotten
>> >> > on
>> >> > your reply.
>> >> >
>> >> > Thanks.
>> >> >
>> >> > On Sun, Sep 27, 2009 at 1:50 PM, Jae-Joon Lee <lee...@gm...>
>> >> > wrote:
>> >> >>
>> >> >> Here is the modified version of your code that works for me.
>> >> >>
>> >> >> 1) If you change trans_aux, you also need to plot your data in an
>> >> >> appropriate coordinate. Your original code did not work because you
>> >> >> scaled the xaxis of the second axes (par) but you were still
>> plotting
>> >> >> the original data, i.e., "time" need to be scaled if you want to
>> plot
>> >> >> it on "par". The code below takes slightly different approach.
>> >> >>
>> >> >> 2) I fount that I was wrong with the factor of 3600. It needs to be
>> >> >> 86400, i.e., a day in seconds. Also, The unit must be larger than 1.
>> >> >> Again, please take a look how datetime unit works.
>> >> >>
>> >> >> Regards,
>> >> >>
>> >> >> -JJ
>> >> >>
>> >> >>
>> >> >> import numpy as np
>> >> >> import matplotlib.pyplot as plt
>> >> >> import matplotlib.transforms as mtransforms
>> >> >> from mpl_toolkits.axes_grid.parasite_axes import SubplotHost
>> >> >>
>> >> >>
>> >> >> # Prepare some random data and time for seconds-from-midnight (sfm)
>> >> >> representation
>> >> >> ydata1 = np.random.random(100) * 1000
>> >> >> ydata2 = np.ones(100) / 2.
>> >> >> time = np.arange(3550, 3650)
>> >> >>
>> >> >>
>> >> >> fig = plt.figure()
>> >> >> host = SubplotHost(fig, 111)
>> >> >> fig.add_subplot(host)
>> >> >>
>> >> >> # This is the heart of the example. We have to scale the axes
>> >> >> correctly.
>> >> >> aux_trans = mtransforms.Affine2D().translate(0., 0.).scale(3600,
>> >> >> ydata1.max())
>> >> >> par = host.twin(aux_trans)
>> >> >>
>> >> >> host.set_xlabel("Time [sfm]")
>> >> >> host.set_ylabel("Random Data 1")
>> >> >> par.set_ylabel("Random Data 2")
>> >> >> par.axis["right"].label.set_visible(True)
>> >> >>
>> >> >> p1, = host.plot(time, ydata1)
>> >> >> p2, = par.plot(time, ydata2)
>> >> >>
>> >> >> host.axis["left"].label.set_color(p1.get_color())
>> >> >> par.axis["right"].label.set_color(p2.get_color())
>> >> >>
>> >> >> host.axis["bottom"].label.set_size(16)
>> >> >> host.axis["left"].label.set_size(16)
>> >> >> par.axis["right"].label.set_size(16)
>> >> >>
>> >> >> # Move the title little upwards so it won't overlap with the
>> ticklabels
>> >> >> title = plt.title("Double time: SFM and HH:MM:SS", fontsize=18)
>> >> >> title.set_position((0.5, 1.05))
>> >> >>
>> >> >> plt.show()
>> >> >>
>> >> >>
>> >> >> On Sun, Sep 27, 2009 at 12:32 PM, Gökhan Sever <
>> gok...@gm...>
>> >> >> wrote:
>> >> >> > Hello,
>> >> >> >
>> >> >> > As was suggested by Jae-Joon, I have simplified the code for
>> easier
>> >> >> > investigation and run. The aim of the script is to have time
>> >> >> > represented
>> >> >> > on
>> >> >> > both bottom and top x-axes, on the bottom in seconds-from-midnight
>> >> >> > (SFM),
>> >> >> > and the top should show as HH:MM:SS, while there is two different
>> >> >> > data
>> >> >> > source being used for y-axes. The code could be seen here or from
>> >> >> >
>> http://code.google.com/p/ccnworks/source/browse/trunk/double_time.py
>> >> >> >
>> >> >> > Currently something wrong with the scaling, since the right y-axis
>> >> >> > data
>> >> >> > is
>> >> >> > missing on the plotting area. Also, sfm hasn't been converted to
>> >> >> > HH:MM:SS.
>> >> >> > adding this:
>> par.xaxis.set_major_formatter(DateFormatter('%H:%M:%S'))
>> >> >> > doesn't remedy the situation as of yet.
>> >> >> >
>> >> >> > All comments are welcome.
>> >> >> >
>> >> >> > ### BEGIN CODE ###
>> >> >> > #!/usr/bin/env python
>> >> >> >
>> >> >> > """
>> >> >> >
>> >> >> > Double time representation. Bottom x-axis shows time in
>> >> >> > seconds-from-midnight
>> >> >> > (sfm) fashion, whereas the top x-axis uses HH:MM:SS
>> representation.
>> >> >> >
>> >> >> > Initially written by Gokhan Sever with helps from Jae-Joon Lee.
>> >> >> >
>> >> >> > Written: 2009年09月27日
>> >> >> >
>> >> >> > """
>> >> >> >
>> >> >> > import numpy as np
>> >> >> > import matplotlib.pyplot as plt
>> >> >> > import matplotlib.transforms as mtransforms
>> >> >> > from mpl_toolkits.axes_grid.parasite_axes import SubplotHost
>> >> >> >
>> >> >> >
>> >> >> > # Prepare some random data and time for seconds-from-midnight
>> (sfm)
>> >> >> > representation
>> >> >> > ydata1 = np.random.random(100) * 1000
>> >> >> > ydata2 = np.ones(100) / 2.
>> >> >> > time = np.arange(3550, 3650)
>> >> >> >
>> >> >> >
>> >> >> > fig = plt.figure()
>> >> >> > host = SubplotHost(fig, 111)
>> >> >> > fig.add_subplot(host)
>> >> >> >
>> >> >> > # This is the heart of the example. We have to scale the axes
>> >> >> > correctly.
>> >> >> > aux_trans = mtransforms.Affine2D().translate(0., 0.).scale(3600,
>> >> >> > ydata1.max())
>> >> >> > par = host.twin(aux_trans)
>> >> >> >
>> >> >> > host.set_xlabel("Time [sfm]")
>> >> >> > host.set_ylabel("Random Data 1")
>> >> >> > par.set_ylabel("Random Data 2")
>> >> >> > par.axis["right"].label.set_visible(True)
>> >> >> >
>> >> >> > p1, = host.plot(time, ydata1)
>> >> >> > p2, = par.plot(time, ydata2)
>> >> >> >
>> >> >> > host.axis["left"].label.set_color(p1.get_color())
>> >> >> > par.axis["right"].label.set_color(p2.get_color())
>> >> >> >
>> >> >> > host.axis["bottom"].label.set_size(16)
>> >> >> > host.axis["left"].label.set_size(16)
>> >> >> > par.axis["right"].label.set_size(16)
>> >> >> >
>> >> >> > # Move the title little upwards so it won't overlap with the
>> >> >> > ticklabels
>> >> >> > title = plt.title("Double time: SFM and HH:MM:SS", fontsize=18)
>> >> >> > title.set_position((0.5, 1.05))
>> >> >> >
>> >> >> > plt.show()
>> >> >> > ### END CODE ###
>> >> >> >
>> >> >> >
>> >> >> > --
>> >> >> > Gökhan
>> >> >> >
>> >> >> >
>> >> >> >
>> >> >> >
>> ------------------------------------------------------------------------------
>> >> >> > Come build with us! The BlackBerry&reg; Developer Conference in
>> SF,
>> >> >> > CA
>> >> >> > is the only developer event you need to attend this year.
>> Jumpstart
>> >> >> > your
>> >> >> > developing skills, take BlackBerry mobile applications to market
>> and
>> >> >> > stay
>> >> >> > ahead of the curve. Join us from November 9&#45;12, 2009. Register
>> >> >> > now&#33;
>> >> >> > http://p.sf.net/sfu/devconf
>> >> >> > _______________________________________________
>> >> >> > Matplotlib-users mailing list
>> >> >> > Mat...@li...
>> >> >> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>> >> >> >
>> >> >> >
>> >> >
>> >> >
>> >> >
>> >> > --
>> >> > Gökhan
>> >> >
>> >
>> >
>> >
>> > --
>> > Gökhan
>> >
>>
>
>
>
> --
> Gökhan
>
-- 
Gökhan
Well, I've been starting working on a pyglet backend but it is 
currently painfully slow mainly because I do not know enough of the 
matplotlib internal machinery to really benefit from it. In the case 
of glumpy, the use of texture object for representing 2d arrays is a 
real speed boost since interpolation/colormap/heightmap is made on the 
GPU.
Concerning matplotlib examples, the use of glumpy should be actually 
two lines of code:
from pylab import *
from glumpy import imshow, show
but I did not package it this way yet (that is easy however).
I guess the main question is whether people are interested in glumpy 
to have a quick & dirty "debug" tool on top of matplotlib or whether 
they prefer a full fledged and fast pyglet/OpenGL backend (which is 
really harder).
Nicolas
On 28 Sep, 2009, at 18:05 , Gökhan Sever wrote:
>
>
> On Mon, Sep 28, 2009 at 9:06 AM, Nicolas Rougier <Nic...@lo... 
> > wrote:
>
> Hi all,
>
> glumpy is a fast OpenGL visualization tool for numpy arrays coded on
> top of pyglet (http://www.pyglet.org/). The package contains many
> demos showing basic usage as well as integration with matplotlib. As a
> reference, the animation script available from matplotlib distribution
> runs at around 500 fps using glumpy instead of 30 fps on my machine.
>
> Package/screenshots/explanations at: http://www.loria.fr/~rougier/coding/glumpy.html
> (it does not require installation so you can run demos from within the
> glumpy directory).
>
>
> Nicolas
> _______________________________________________
> NumPy-Discussion mailing list
> Num...@sc...
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
> Hi Nicolas,
>
> This is technically called OpenGL backend, isn't it? It is nice that 
> integrates with matplotlib, however 300 hundred lines of code indeed 
> a lot of lines for an ordinary user. Do you think this could be 
> further integrated into matplotlib with a wrapper to simplify its 
> usage?
>
>
> -- 
> Gökhan
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart 
> your
> developing skills, take BlackBerry mobile applications to market and 
> stay
> ahead of the curve. Join us from November 9&#45;12, 2009. Register 
> now&#33;
> http://p.sf.net/sfu/devconf_______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Nyx <mc...@cs...> - 2009年09月28日 16:34:51
Hello,
I want to dynamically update a plot of the rate at which a neural network is
learning a function. Ideally, my python program would open up a window and
update the plot inside of it after every training epoch.
I have written the following code to do so:
	pyplot.title('Learning Curve')
	pyplot.xlabel('Epoch #')
	pyplot.ylabel('Success rate (%)')
	pyplot.plot(range(1, len(rates)+1), rates, 'r-')
	pyplot.draw()
Note that I am also calling pyplot.ion() at the start of the program.
This *mostly* works. However, I run into a strange issue. If the figure
window is minimized/hidden, when I open it up, nothing shows up in it (the
content is only grey). The plot will appear only if the window is
maximized/visible when the plotting occurs. If I again minimize the window
after the plot was drawn, it goes back to being gray.
-- 
View this message in context: http://www.nabble.com/Plot-Updating-Strangeness-tp25648628p25648628.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
On Mon, Sep 28, 2009 at 9:06 AM, Nicolas Rougier
<Nic...@lo...>wrote:
>
> Hi all,
>
> glumpy is a fast OpenGL visualization tool for numpy arrays coded on
> top of pyglet (http://www.pyglet.org/). The package contains many
> demos showing basic usage as well as integration with matplotlib. As a
> reference, the animation script available from matplotlib distribution
> runs at around 500 fps using glumpy instead of 30 fps on my machine.
>
> Package/screenshots/explanations at:
> http://www.loria.fr/~rougier/coding/glumpy.html<http://www.loria.fr/%7Erougier/coding/glumpy.html>
> (it does not require installation so you can run demos from within the
> glumpy directory).
>
>
> Nicolas
> _______________________________________________
> NumPy-Discussion mailing list
> Num...@sc...
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
Hi Nicolas,
This is technically called OpenGL backend, isn't it? It is nice that
integrates with matplotlib, however 300 hundred lines of code indeed a lot
of lines for an ordinary user. Do you think this could be further integrated
into matplotlib with a wrapper to simplify its usage?
-- 
Gökhan
From: Nicolas R. <Nic...@lo...> - 2009年09月28日 14:06:40
Hi all,
glumpy is a fast OpenGL visualization tool for numpy arrays coded on 
top of pyglet (http://www.pyglet.org/). The package contains many 
demos showing basic usage as well as integration with matplotlib. As a 
reference, the animation script available from matplotlib distribution 
runs at around 500 fps using glumpy instead of 30 fps on my machine.
Package/screenshots/explanations at: http://www.loria.fr/~rougier/coding/glumpy.html
(it does not require installation so you can run demos from within the 
glumpy directory).
Nicolas
From: Uri L. <las...@mi...> - 2009年09月28日 14:04:42
Is it possible to specify a path object that will use different
transforms for different vertices?
This is again related to plotting a box whose height is specified by
data coords, but whose width is a constant in axes coords regardless
of scale (so linear and log x-scales would produce a box of the same
width).
Ideally, I would draw a path like this:
1. the center of the box would be located at x and bottom and top
would be y1, y2, all in data coords
2. I would move to (x,y1) at the bottom-center of the box.
3. The x value would now need to be converted to Axes coords, possibly
by applying transData + transAxes.inverted
4. I would want to draw a line to (x-0.1, y1) where x is now in axes
coords and y is still in data coords. Then up, then right, then down,
and then close the polygon.
How do I implement this?
As I mentioned before, a blended transform would allow me to make the
moves i am interested in. However, a change of scale would change the
correspondence between data and axes coords, so the axes transform
part of the blended axes would have to be recomputed everytime the
scale changes based on where the (x,y1) point lands in the axes. Is
this correct?
Any suggestions are welcome...thanks!
Uri
-- 
Uri Laserson
PhD Candidate, Biomedical Engineering
Harvard Medical School (Genetics)
Massachusetts Institute of Technology (Mathematics)
phone +1 917 742 8019
las...@mi...
From: Chris <ce...@gm...> - 2009年09月28日 12:10:21
Hi,
I'm having trouble building matplotlib 0.99.1.1 (transcript below). 
I'm using copies of Python (2.5.1) and Tcl/Tk (8.5.5) that I have
built myself, and that are apparently working fine. Previously, I was
using this exact procedure to build 0.91.4 without any problems.
Any suggestions would be greatly appreciated - thanks!
Chris
$ cd matplotlib-0.99.1.1
$ env PREFIX=/a/b/ LD_LIBRARY_PATH=/a/b/lib /a/b/bin/python setup.py build
============================================================================
BUILDING MATPLOTLIB
 matplotlib: 0.99.1.1
 python: 2.5.1 (r251:54863, Feb 5 2009, 13:11:08) [GCC
 4.1.2 20071124 (Red Hat 4.1.2-42)]
 platform: linux2
REQUIRED DEPENDENCIES
 numpy: 1.2.1
 freetype2: 9.10.3
OPTIONAL BACKEND DEPENDENCIES
 libpng: 1.2.10
 Tkinter: Tkinter: 50704, Tk: 8.5, Tcl: 8.5
 Gtk+: no
 * Building for Gtk+ requires pygtk; you must be able
 * to "import gtk" in your build/install environment
 Mac OS X native: no
 Qt: no
 Qt4: no
 Cairo: no
OPTIONAL DATE/TIMEZONE DEPENDENCIES
 datetime: present, version unknown
 dateutil: matplotlib will provide
 pytz: matplotlib will provide
adding pytz
OPTIONAL USETEX DEPENDENCIES
 dvipng: 1.5
 ghostscript: 8.15.2
 latex: 3.141592
 pdftops: 3.00
[Edit setup.cfg to suppress the above messages]
============================================================================
pymods ['pylab']
packages ['matplotlib', 'matplotlib.backends', 'matplotlib.projections',
'mpl_toolkits', 'mpl_toolkits.mplot3d', 'mpl_too\
lkits.axes_grid', 'matplotlib.sphinxext', 'matplotlib.numerix',
'matplotlib.numerix.mlab', 'matplotlib.numerix.ma', 'matp\
lotlib.numerix.linear_algebra', 'matplotlib.numerix.random_array',
'matplotlib.numerix.fft', 'matplotlib.delaunay', 'pytz\
', 'dateutil', 'dateutil/zoneinfo']
running build
running build_py
copying lib/matplotlib/mpl-data/matplotlibrc ->
build/lib.linux-i686-2.5/matplotlib/mpl-data
copying lib/matplotlib/mpl-data/matplotlib.conf ->
build/lib.linux-i686-2.5/matplotlib/mpl-data
running build_ext
building 'matplotlib.backends._tkagg' extension
g++ -pthread -shared build/temp.linux-i686-2.5/src/agg_py_transforms.o
build/temp.linux-i686-2.5/src/_tkagg.o build/temp.\
linux-i686-2.5/CXX/cxx_extensions.o build/temp.linux-i686-2.5/CXX/cxxsupport.o
build/temp.linux-i686-2.5/CXX/IndirectPyth\
onInterface.o build/temp.linux-i686-2.5/CXX/cxxextensions.o -L/usr/lib
-L/usr/lib -L/usr/local/lib -L/usr/lib -L/usr/lib6\
4 -L/usr/local/lib -L/usr/lib -L/usr/lib64 -ltk8.5 -ltcl8.5 -lstdc++ -lm
-lfreetype -lz -lstdc++ -lm -o build/lib.linux-i\
686-2.5/matplotlib/backends/_tkagg.so
/usr/bin/ld: cannot find -ltk8.5
collect2: ld returned 1 exit status
error: command 'g++' failed with exit status 1
make: *** [matplotlib] Error 1
$ ls /a/b/lib/*tk*
lib/libtk8.5.so lib/libtkstub8.5.a lib/tkConfig.sh
...
From: Ralph K. <ral...@go...> - 2009年09月28日 12:09:44
Hi,
is there a way to update a contour plot? I need to display a series of
contour plots from a directory with data files and want to view them
consecutively, preferrably without building a gui for it. Is there an 
easy way out?
Cheers, Ralph
From: Ralph K. <rk...@po...> - 2009年09月28日 11:34:04
Hi,
is there a way to update a contour plot? I need to display a series of
contour plots from a directory with data files and want to view them
consecutively, preferrably without building a gui for it. Is there an 
easy way out?
Cheers, Ralph
From: Christopher Barrington-L. <cpb...@gm...> - 2009年09月28日 02:18:22
Hello. My problem is as follows:
(ipython --pylab)
from pylab import *
pp=plot([0,0],[1,1])
text(xlim()[0],1,' Need padding ',horizontalalignment='left')
text(xlim()[1],1,' Need padding ',horizontalalignment='right')
The second case does not do what I want, which is to pad the text on the
right. Text strings are stripped on the right, but no on the left. How can I
elegantly create a character of space?
Thanks!
c
-- 
View this message in context: http://www.nabble.com/trailing-space-in-text-string-stripped%2C-making-it-impossible-to-right-pad-my-text-tp25639703p25639703.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: John H. <jd...@gm...> - 2009年09月28日 02:07:19
On Sun, Sep 27, 2009 at 3:45 PM, Peter Butterworth <bu...@gm...> wrote:
> On Sun, Sep 27, 2009 at 9:31 PM, Jae-Joon Lee <lee...@gm...> wrote:
>>> Some feedback: If plotting a line2D as discrete points rather than a
>>> continuous line, you must use numpoints=2 for the legend picking to actually
>>> occur on the points. The alpha blending doesn't work on the legend symbols
>>> however.
>>>
>>
>> I tried numpoints=1,2,3 but all worked for me. Can someone else confirm this?
>
> I'm using windows and mpl 0.99.0:
Most of the enhancements to support legend picking happened after 99.0
-- you probably need to be on svn trunk (I don't think 99.1 would work
either). The example is working fine for me on svn HEAD (regardless
of ncol) with one exception: if I use a marker instead of a line, the
alpha is not respected (the line markers are simply turned off).
Apparently we need to fix Line2D to respect the alpha setting for
markers in this use case.
JDH
>
>
>
>> The alpha for legend symbols does not work since, inside legend, the
>> lines and symbols are drawn by different artists.
>>
>> Try something like below.
>>
>>
>>    legline.set_alpha(1.0)
>>    try:
>>      legline._legmarker.set_alpha(1.0)
>>    except AttributeError:
>>      pass
>>
>>
>>
>>> Is there any other way, I can show in the legend whether the points of the
>>> series are visible or not ?
>>>
>>> I thought of changing the labels, but failed to get them to redraw.
>>>
>>
>> Legend.get_texts() method returns the list of Text instances.
>>
>> http://matplotlib.sourceforge.net/api/artist_api.html?highlight=legend#matplotlib.legend.Legend.get_texts
>>
>> You may modify the returned Text instances.
>>
>> -JJ
>>
>
> works great.
>
>
>
>>
>>> # plots:
>>> ax.plot(t, y1, 'ro', picker=5, label='lab1')
>>> ax.plot(t, y2, 'bo', picker=5, label='lab2')
>>>
>>> # legend
>>> leg = ax.legend(loc='upper left', numpoints=2, fancybox=True, shadow=True)
>>> lines, labels = ax.get_legend_handles_labels()
>>>
>>> # Enable picking on the legend lines
>>> leglines=leg.get_lines()
>>> for legline in leglines: legline.set_picker(5)
>
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart your
> developing skills, take BlackBerry mobile applications to market and stay
> ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
> http://p.sf.net/sfu/devconf
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: Jae-Joon L. <lee...@gm...> - 2009年09月28日 00:44:34
On Sun, Sep 27, 2009 at 4:18 PM, Gökhan Sever <gok...@gm...> wrote:
> When I run this as it is, and zoom once the top x-axis ticklabels disappear:
> http://img2.imageshack.us/img2/5493/zoom1.png
>
> After commenting these three lines:
>
> #locator  = MinuteLocator(interval=1)
> #locator  = SecondLocator(interval=30)
> #par2.xaxis.set_major_locator(locator)
>
> and running I get somewhat nice view after zooms:
> http://img340.imageshack.us/img340/6632/zoom2.png
>
> with a minute discrepancy; resulting with shifts on the top x-labels.
>
> Any last thoughts?
>
I believe that this is due to wrong tick locations. As you easily
guess, the default tick locators are not suitable for datetime ticks
and this is why we have separate locators. Please take a look at
documentations.
http://matplotlib.sourceforge.net/api/dates_api.html
If you want to have locator that works for several zoom levels, you
may try AutoDateLocator.
from matplotlib.dates import DateFormatter, MinuteLocator,
SecondLocator, AutoDateLocator, AutoDateFormatter
locator = AutoDateLocator()
par2.xaxis.set_major_locator(locator)
formatter=AutoDateFormatter(locator)
par2.xaxis.set_major_formatter(formatter)
par2.axis["top"].major_ticklabels.set(rotation=30,
 ha="left",
 va="bottom")
While the AutoLocator seems to give too may ticks in my opinion, I
think this is as far as I can help.
Regards,
-JJ
> On Sun, Sep 27, 2009 at 2:12 PM, Jae-Joon Lee <lee...@gm...> wrote:
>>
>> Here it is.
>>
>> -JJ
>>
>> On Sun, Sep 27, 2009 at 3:09 PM, Gökhan Sever <gok...@gm...>
>> wrote:
>> > JJ,
>> >
>> > Could you please re-attach the code? Apparently, it has been forgotten
>> > on
>> > your reply.
>> >
>> > Thanks.
>> >
>> > On Sun, Sep 27, 2009 at 1:50 PM, Jae-Joon Lee <lee...@gm...>
>> > wrote:
>> >>
>> >> Here is the modified version of your code that works for me.
>> >>
>> >> 1) If you change trans_aux, you also need to plot your data in an
>> >> appropriate coordinate. Your original code did not work because you
>> >> scaled the xaxis of the second axes (par) but you were still plotting
>> >> the original data, i.e., "time" need to be scaled if you want to plot
>> >> it on "par". The code below takes slightly different approach.
>> >>
>> >> 2) I fount that I was wrong with the factor of 3600. It needs to be
>> >> 86400, i.e., a day in seconds. Also, The unit must be larger than 1.
>> >> Again, please take a look how datetime unit works.
>> >>
>> >> Regards,
>> >>
>> >> -JJ
>> >>
>> >>
>> >> import numpy as np
>> >> import matplotlib.pyplot as plt
>> >> import matplotlib.transforms as mtransforms
>> >> from mpl_toolkits.axes_grid.parasite_axes import SubplotHost
>> >>
>> >>
>> >> # Prepare some random data and time for seconds-from-midnight (sfm)
>> >> representation
>> >> ydata1 = np.random.random(100) * 1000
>> >> ydata2 = np.ones(100) / 2.
>> >> time = np.arange(3550, 3650)
>> >>
>> >>
>> >> fig = plt.figure()
>> >> host = SubplotHost(fig, 111)
>> >> fig.add_subplot(host)
>> >>
>> >> # This is the heart of the example. We have to scale the axes
>> >> correctly.
>> >> aux_trans = mtransforms.Affine2D().translate(0., 0.).scale(3600,
>> >> ydata1.max())
>> >> par = host.twin(aux_trans)
>> >>
>> >> host.set_xlabel("Time [sfm]")
>> >> host.set_ylabel("Random Data 1")
>> >> par.set_ylabel("Random Data 2")
>> >> par.axis["right"].label.set_visible(True)
>> >>
>> >> p1, = host.plot(time, ydata1)
>> >> p2, = par.plot(time, ydata2)
>> >>
>> >> host.axis["left"].label.set_color(p1.get_color())
>> >> par.axis["right"].label.set_color(p2.get_color())
>> >>
>> >> host.axis["bottom"].label.set_size(16)
>> >> host.axis["left"].label.set_size(16)
>> >> par.axis["right"].label.set_size(16)
>> >>
>> >> # Move the title little upwards so it won't overlap with the ticklabels
>> >> title = plt.title("Double time: SFM and HH:MM:SS", fontsize=18)
>> >> title.set_position((0.5, 1.05))
>> >>
>> >> plt.show()
>> >>
>> >>
>> >> On Sun, Sep 27, 2009 at 12:32 PM, Gökhan Sever <gok...@gm...>
>> >> wrote:
>> >> > Hello,
>> >> >
>> >> > As was suggested by Jae-Joon, I have simplified the code for easier
>> >> > investigation and run. The aim of the script is to have time
>> >> > represented
>> >> > on
>> >> > both bottom and top x-axes, on the bottom in seconds-from-midnight
>> >> > (SFM),
>> >> > and the top should show as HH:MM:SS, while there is two different
>> >> > data
>> >> > source being used for y-axes. The code could be seen here or from
>> >> > http://code.google.com/p/ccnworks/source/browse/trunk/double_time.py
>> >> >
>> >> > Currently something wrong with the scaling, since the right y-axis
>> >> > data
>> >> > is
>> >> > missing on the plotting area. Also, sfm hasn't been converted to
>> >> > HH:MM:SS.
>> >> > adding this: par.xaxis.set_major_formatter(DateFormatter('%H:%M:%S'))
>> >> > doesn't remedy the situation as of yet.
>> >> >
>> >> > All comments are welcome.
>> >> >
>> >> > ### BEGIN CODE ###
>> >> > #!/usr/bin/env python
>> >> >
>> >> > """
>> >> >
>> >> > Double time representation. Bottom x-axis shows time in
>> >> > seconds-from-midnight
>> >> > (sfm) fashion, whereas the top x-axis uses HH:MM:SS representation.
>> >> >
>> >> > Initially written by Gokhan Sever with helps from Jae-Joon Lee.
>> >> >
>> >> > Written: 2009年09月27日
>> >> >
>> >> > """
>> >> >
>> >> > import numpy as np
>> >> > import matplotlib.pyplot as plt
>> >> > import matplotlib.transforms as mtransforms
>> >> > from mpl_toolkits.axes_grid.parasite_axes import SubplotHost
>> >> >
>> >> >
>> >> > # Prepare some random data and time for seconds-from-midnight (sfm)
>> >> > representation
>> >> > ydata1 = np.random.random(100) * 1000
>> >> > ydata2 = np.ones(100) / 2.
>> >> > time = np.arange(3550, 3650)
>> >> >
>> >> >
>> >> > fig = plt.figure()
>> >> > host = SubplotHost(fig, 111)
>> >> > fig.add_subplot(host)
>> >> >
>> >> > # This is the heart of the example. We have to scale the axes
>> >> > correctly.
>> >> > aux_trans = mtransforms.Affine2D().translate(0., 0.).scale(3600,
>> >> > ydata1.max())
>> >> > par = host.twin(aux_trans)
>> >> >
>> >> > host.set_xlabel("Time [sfm]")
>> >> > host.set_ylabel("Random Data 1")
>> >> > par.set_ylabel("Random Data 2")
>> >> > par.axis["right"].label.set_visible(True)
>> >> >
>> >> > p1, = host.plot(time, ydata1)
>> >> > p2, = par.plot(time, ydata2)
>> >> >
>> >> > host.axis["left"].label.set_color(p1.get_color())
>> >> > par.axis["right"].label.set_color(p2.get_color())
>> >> >
>> >> > host.axis["bottom"].label.set_size(16)
>> >> > host.axis["left"].label.set_size(16)
>> >> > par.axis["right"].label.set_size(16)
>> >> >
>> >> > # Move the title little upwards so it won't overlap with the
>> >> > ticklabels
>> >> > title = plt.title("Double time: SFM and HH:MM:SS", fontsize=18)
>> >> > title.set_position((0.5, 1.05))
>> >> >
>> >> > plt.show()
>> >> > ### END CODE ###
>> >> >
>> >> >
>> >> > --
>> >> > Gökhan
>> >> >
>> >> >
>> >> >
>> >> > ------------------------------------------------------------------------------
>> >> > Come build with us! The BlackBerry&reg; Developer Conference in SF,
>> >> > CA
>> >> > is the only developer event you need to attend this year. Jumpstart
>> >> > your
>> >> > developing skills, take BlackBerry mobile applications to market and
>> >> > stay
>> >> > ahead of the curve. Join us from November 9&#45;12, 2009. Register
>> >> > now&#33;
>> >> > http://p.sf.net/sfu/devconf
>> >> > _______________________________________________
>> >> > Matplotlib-users mailing list
>> >> > Mat...@li...
>> >> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>> >> >
>> >> >
>> >
>> >
>> >
>> > --
>> > Gökhan
>> >
>
>
>
> --
> Gökhan
>
From: Peter B. <bu...@gm...> - 2009年09月27日 20:45:55
On Sun, Sep 27, 2009 at 9:31 PM, Jae-Joon Lee <lee...@gm...> wrote:
>> Some feedback: If plotting a line2D as discrete points rather than a
>> continuous line, you must use numpoints=2 for the legend picking to actually
>> occur on the points. The alpha blending doesn't work on the legend symbols
>> however.
>>
>
> I tried numpoints=1,2,3 but all worked for me. Can someone else confirm this?
I'm using windows and mpl 0.99.0:
numpoints=2 or 3 work
with numpoints=1 the pick does not occur on the symbol but where it
would be with numpoints=2
> The alpha for legend symbols does not work since, inside legend, the
> lines and symbols are drawn by different artists.
>
> Try something like below.
>
>
> legline.set_alpha(1.0)
> try:
> legline._legmarker.set_alpha(1.0)
> except AttributeError:
> pass
>
>
>
>> Is there any other way, I can show in the legend whether the points of the
>> series are visible or not ?
>>
>> I thought of changing the labels, but failed to get them to redraw.
>>
>
> Legend.get_texts() method returns the list of Text instances.
>
> http://matplotlib.sourceforge.net/api/artist_api.html?highlight=legend#matplotlib.legend.Legend.get_texts
>
> You may modify the returned Text instances.
>
> -JJ
>
works great.
>
>> # plots:
>> ax.plot(t, y1, 'ro', picker=5, label='lab1')
>> ax.plot(t, y2, 'bo', picker=5, label='lab2')
>>
>> # legend
>> leg = ax.legend(loc='upper left', numpoints=2, fancybox=True, shadow=True)
>> lines, labels = ax.get_legend_handles_labels()
>>
>> # Enable picking on the legend lines
>> leglines=leg.get_lines()
>> for legline in leglines: legline.set_picker(5)
From: Gökhan S. <gok...@gm...> - 2009年09月27日 20:32:51
On Sun, Sep 27, 2009 at 3:04 PM, Jae-Joon Lee <lee...@gm...> wrote:
> Take a look at the examples/pylab_examples/demo_agg_filter.py
>
> Attached is a simple example that shows a line with gradient.
> However, the current image filter does not know about the data
> coordinate of the input image. Therefore, if you want to have your
> gradient stops at certain data values, you need to specify this in
> some manual way when you create the filter.
>
> Maybe the second approach that I mentioned might be more reasonable.
>
Agree. That first code is not an easy bite for me. I can tackle the second
one easily.
Thanks for the advice and pointers :)
>
> Regards,
>
> -JJ
>
>
>
>
> On Sun, Sep 27, 2009 at 2:25 AM, Gökhan Sever <gok...@gm...>
> wrote:
> >
> >
> > On Sat, Sep 26, 2009 at 10:16 PM, Jae-Joon Lee <lee...@gm...>
> wrote:
> >>
> >> The gradient, in general, is not supported by matplotlib yet.
> >> If you're only interested in raster format outputs (like png), I
> >> think you can use agg_filter functionality (but you need svn version
> >> of mpl).
> >
> > Could you give me a pointer on this where to look for the agg_filter,
> since
> > the search option doesn't yield any helpful results.
> >
> > I use the svn compiled matplotlib and docs.
> >
> > Thanks.
> >
> >
> >>
> >> Other wise, I guess your best bet is to divide you line into many
> >> segments and color them differently.
> >>
> >> -JJ
> >>
> >>
> >> On Sat, Sep 26, 2009 at 10:27 PM, Gökhan Sever <gok...@gm...>
> >> wrote:
> >> > Hello,
> >> >
> >> > Is it possible use a gradient color say from blue to red and/or
> >> > specifying
> >> > certain color threshold for a line plot (i.e I have air temperature
> >> > plotted
> >> > and I want to segment the color of the plot for temp > 0C red, and
> below
> >> > 0
> >> > make it blue.) Would be much nicer with gradient however I am content
> >> > for
> >> > the second option as well :)
> >> >
> >> > Thanks.
> >> >
> >> > --
> >> > Gökhan
> >> >
> >> >
> >> >
> ------------------------------------------------------------------------------
> >> > Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
> >> > is the only developer event you need to attend this year. Jumpstart
> your
> >> > developing skills, take BlackBerry mobile applications to market and
> >> > stay
> >> > ahead of the curve. Join us from November 9&#45;12, 2009. Register
> >> > now&#33;
> >> > http://p.sf.net/sfu/devconf
> >> > _______________________________________________
> >> > Matplotlib-users mailing list
> >> > Mat...@li...
> >> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> >> >
> >> >
> >
> >
> >
> > --
> > Gökhan
> >
>
-- 
Gökhan
From: Gökhan S. <gok...@gm...> - 2009年09月27日 20:18:47
When I run this as it is, and zoom once the top x-axis ticklabels disappear:
http://img2.imageshack.us/img2/5493/zoom1.png
After commenting these three lines:
#locator = MinuteLocator(interval=1)
#locator = SecondLocator(interval=30)
#par2.xaxis.set_major_locator(locator)
and running I get somewhat nice view after zooms:
http://img340.imageshack.us/img340/6632/zoom2.png
with a minute discrepancy; resulting with shifts on the top x-labels.
Any last thoughts?
On Sun, Sep 27, 2009 at 2:12 PM, Jae-Joon Lee <lee...@gm...> wrote:
> Here it is.
>
> -JJ
>
> On Sun, Sep 27, 2009 at 3:09 PM, Gökhan Sever <gok...@gm...>
> wrote:
> > JJ,
> >
> > Could you please re-attach the code? Apparently, it has been forgotten on
> > your reply.
> >
> > Thanks.
> >
> > On Sun, Sep 27, 2009 at 1:50 PM, Jae-Joon Lee <lee...@gm...>
> wrote:
> >>
> >> Here is the modified version of your code that works for me.
> >>
> >> 1) If you change trans_aux, you also need to plot your data in an
> >> appropriate coordinate. Your original code did not work because you
> >> scaled the xaxis of the second axes (par) but you were still plotting
> >> the original data, i.e., "time" need to be scaled if you want to plot
> >> it on "par". The code below takes slightly different approach.
> >>
> >> 2) I fount that I was wrong with the factor of 3600. It needs to be
> >> 86400, i.e., a day in seconds. Also, The unit must be larger than 1.
> >> Again, please take a look how datetime unit works.
> >>
> >> Regards,
> >>
> >> -JJ
> >>
> >>
> >> import numpy as np
> >> import matplotlib.pyplot as plt
> >> import matplotlib.transforms as mtransforms
> >> from mpl_toolkits.axes_grid.parasite_axes import SubplotHost
> >>
> >>
> >> # Prepare some random data and time for seconds-from-midnight (sfm)
> >> representation
> >> ydata1 = np.random.random(100) * 1000
> >> ydata2 = np.ones(100) / 2.
> >> time = np.arange(3550, 3650)
> >>
> >>
> >> fig = plt.figure()
> >> host = SubplotHost(fig, 111)
> >> fig.add_subplot(host)
> >>
> >> # This is the heart of the example. We have to scale the axes correctly.
> >> aux_trans = mtransforms.Affine2D().translate(0., 0.).scale(3600,
> >> ydata1.max())
> >> par = host.twin(aux_trans)
> >>
> >> host.set_xlabel("Time [sfm]")
> >> host.set_ylabel("Random Data 1")
> >> par.set_ylabel("Random Data 2")
> >> par.axis["right"].label.set_visible(True)
> >>
> >> p1, = host.plot(time, ydata1)
> >> p2, = par.plot(time, ydata2)
> >>
> >> host.axis["left"].label.set_color(p1.get_color())
> >> par.axis["right"].label.set_color(p2.get_color())
> >>
> >> host.axis["bottom"].label.set_size(16)
> >> host.axis["left"].label.set_size(16)
> >> par.axis["right"].label.set_size(16)
> >>
> >> # Move the title little upwards so it won't overlap with the ticklabels
> >> title = plt.title("Double time: SFM and HH:MM:SS", fontsize=18)
> >> title.set_position((0.5, 1.05))
> >>
> >> plt.show()
> >>
> >>
> >> On Sun, Sep 27, 2009 at 12:32 PM, Gökhan Sever <gok...@gm...>
> >> wrote:
> >> > Hello,
> >> >
> >> > As was suggested by Jae-Joon, I have simplified the code for easier
> >> > investigation and run. The aim of the script is to have time
> represented
> >> > on
> >> > both bottom and top x-axes, on the bottom in seconds-from-midnight
> >> > (SFM),
> >> > and the top should show as HH:MM:SS, while there is two different data
> >> > source being used for y-axes. The code could be seen here or from
> >> > http://code.google.com/p/ccnworks/source/browse/trunk/double_time.py
> >> >
> >> > Currently something wrong with the scaling, since the right y-axis
> data
> >> > is
> >> > missing on the plotting area. Also, sfm hasn't been converted to
> >> > HH:MM:SS.
> >> > adding this: par.xaxis.set_major_formatter(DateFormatter('%H:%M:%S'))
> >> > doesn't remedy the situation as of yet.
> >> >
> >> > All comments are welcome.
> >> >
> >> > ### BEGIN CODE ###
> >> > #!/usr/bin/env python
> >> >
> >> > """
> >> >
> >> > Double time representation. Bottom x-axis shows time in
> >> > seconds-from-midnight
> >> > (sfm) fashion, whereas the top x-axis uses HH:MM:SS representation.
> >> >
> >> > Initially written by Gokhan Sever with helps from Jae-Joon Lee.
> >> >
> >> > Written: 2009年09月27日
> >> >
> >> > """
> >> >
> >> > import numpy as np
> >> > import matplotlib.pyplot as plt
> >> > import matplotlib.transforms as mtransforms
> >> > from mpl_toolkits.axes_grid.parasite_axes import SubplotHost
> >> >
> >> >
> >> > # Prepare some random data and time for seconds-from-midnight (sfm)
> >> > representation
> >> > ydata1 = np.random.random(100) * 1000
> >> > ydata2 = np.ones(100) / 2.
> >> > time = np.arange(3550, 3650)
> >> >
> >> >
> >> > fig = plt.figure()
> >> > host = SubplotHost(fig, 111)
> >> > fig.add_subplot(host)
> >> >
> >> > # This is the heart of the example. We have to scale the axes
> correctly.
> >> > aux_trans = mtransforms.Affine2D().translate(0., 0.).scale(3600,
> >> > ydata1.max())
> >> > par = host.twin(aux_trans)
> >> >
> >> > host.set_xlabel("Time [sfm]")
> >> > host.set_ylabel("Random Data 1")
> >> > par.set_ylabel("Random Data 2")
> >> > par.axis["right"].label.set_visible(True)
> >> >
> >> > p1, = host.plot(time, ydata1)
> >> > p2, = par.plot(time, ydata2)
> >> >
> >> > host.axis["left"].label.set_color(p1.get_color())
> >> > par.axis["right"].label.set_color(p2.get_color())
> >> >
> >> > host.axis["bottom"].label.set_size(16)
> >> > host.axis["left"].label.set_size(16)
> >> > par.axis["right"].label.set_size(16)
> >> >
> >> > # Move the title little upwards so it won't overlap with the
> ticklabels
> >> > title = plt.title("Double time: SFM and HH:MM:SS", fontsize=18)
> >> > title.set_position((0.5, 1.05))
> >> >
> >> > plt.show()
> >> > ### END CODE ###
> >> >
> >> >
> >> > --
> >> > Gökhan
> >> >
> >> >
> >> >
> ------------------------------------------------------------------------------
> >> > Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
> >> > is the only developer event you need to attend this year. Jumpstart
> your
> >> > developing skills, take BlackBerry mobile applications to market and
> >> > stay
> >> > ahead of the curve. Join us from November 9&#45;12, 2009. Register
> >> > now&#33;
> >> > http://p.sf.net/sfu/devconf
> >> > _______________________________________________
> >> > Matplotlib-users mailing list
> >> > Mat...@li...
> >> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> >> >
> >> >
> >
> >
> >
> > --
> > Gökhan
> >
>
-- 
Gökhan
From: Jae-Joon L. <lee...@gm...> - 2009年09月27日 20:04:36
Take a look at the examples/pylab_examples/demo_agg_filter.py
Attached is a simple example that shows a line with gradient.
However, the current image filter does not know about the data
coordinate of the input image. Therefore, if you want to have your
gradient stops at certain data values, you need to specify this in
some manual way when you create the filter.
Maybe the second approach that I mentioned might be more reasonable.
Regards,
-JJ
On Sun, Sep 27, 2009 at 2:25 AM, Gökhan Sever <gok...@gm...> wrote:
>
>
> On Sat, Sep 26, 2009 at 10:16 PM, Jae-Joon Lee <lee...@gm...> wrote:
>>
>> The gradient, in general, is not supported by matplotlib yet.
>> If you're only interested in raster format outputs (like png), I
>> think you can use agg_filter functionality (but you need svn version
>> of mpl).
>
> Could you give me a pointer on this where to look for the agg_filter, since
> the search option doesn't yield any helpful results.
>
> I use the svn compiled matplotlib and docs.
>
> Thanks.
>
>
>>
>> Other wise, I guess your best bet is to divide you line into many
>> segments and color them differently.
>>
>> -JJ
>>
>>
>> On Sat, Sep 26, 2009 at 10:27 PM, Gökhan Sever <gok...@gm...>
>> wrote:
>> > Hello,
>> >
>> > Is it possible use a gradient color say from blue to red and/or
>> > specifying
>> > certain color threshold for a line plot (i.e I have air temperature
>> > plotted
>> > and I want to segment the color of the plot for temp > 0C red, and below
>> > 0
>> > make it blue.) Would be much nicer with gradient however I am content
>> > for
>> > the second option as well :)
>> >
>> > Thanks.
>> >
>> > --
>> > Gökhan
>> >
>> >
>> > ------------------------------------------------------------------------------
>> > Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
>> > is the only developer event you need to attend this year. Jumpstart your
>> > developing skills, take BlackBerry mobile applications to market and
>> > stay
>> > ahead of the curve. Join us from November 9&#45;12, 2009. Register
>> > now&#33;
>> > http://p.sf.net/sfu/devconf
>> > _______________________________________________
>> > Matplotlib-users mailing list
>> > Mat...@li...
>> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>> >
>> >
>
>
>
> --
> Gökhan
>
From: Jae-Joon L. <lee...@gm...> - 2009年09月27日 19:31:47
On Sun, Sep 27, 2009 at 10:02 AM, butterw <bu...@gm...> wrote:
>
> Hi,
>
> thank you for clearing that up.
>
>
> Some feedback: If plotting a line2D as discrete points rather than a
> continuous line, you must use numpoints=2 for the legend picking to actually
> occur on the points. The alpha blending doesn't work on the legend symbols
> however.
>
I tried numpoints=1,2,3 but all worked for me. Can someone else confirm this?
The alpha for legend symbols does not work since, inside legend, the
lines and symbols are drawn by different artists.
Try something like below.
 legline.set_alpha(1.0)
 try:
 legline._legmarker.set_alpha(1.0)
 except AttributeError:
 pass
> Is there any other way, I can show in the legend whether the points of the
> series are visible or not ?
>
> I thought of changing the labels, but failed to get them to redraw.
>
Legend.get_texts() method returns the list of Text instances.
http://matplotlib.sourceforge.net/api/artist_api.html?highlight=legend#matplotlib.legend.Legend.get_texts
You may modify the returned Text instances.
-JJ
> # plots:
> ax.plot(t, y1, 'ro', picker=5, label='lab1')
> ax.plot(t, y2, 'bo', picker=5, label='lab2')
>
> # legend
> leg = ax.legend(loc='upper left', numpoints=2, fancybox=True, shadow=True)
> lines, labels = ax.get_legend_handles_labels()
>
> # Enable picking on the legend lines
> leglines=leg.get_lines()
> for legline in leglines: legline.set_picker(5)
>
>
>
>
>
> Jae-Joon Lee wrote:
>>
>> On Wed, Sep 23, 2009 at 3:27 PM, butterw <bu...@gm...> wrote:
>>>
>>> Hi,
>>>
>>> pickers work great to make matplotlib plots more interactive/general user
>>> friendly.
>>>
>>> On the subject of the legend_picker.py example, I was wondering if it was
>>> possible to combine both a legend picker and a line picker in the same
>>> plot.
>>> From what I gather they will both use the same onpick event callback.
>>>
>>> So my question is : How do I discriminate between a pick on the legend
>>> from
>>> a pick on a line ? The event.artist is a line2D in both cases.
>>
>> As demonstrated in the above example, leg.get_lines() gives you the
>> list of lines inside the legend. The list of original lines is kept in
>> ax.lines.
>> So, you can check in which list the given artist is.
>>
>> Regards,
>>
>> -JJ
>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> John Hunter-4 wrote:
>>>>
>>>> On Mon, Aug 3, 2009 at 11:38 PM, Gökhan Sever<gok...@gm...>
>>>> wrote:
>>>>> Hello,
>>>>>
>>>>> I was wondering if it is possible to hide some data on figures using a
>>>>> say
>>>>> right click option to any of the legend entry and make it temporarily
>>>>> hidden/visible to better analyse the rest of the data?
>>>>>
>>>>> Check this screenshot for example:
>>>>>
>>>>> http://img25.imageshack.us/img25/9427/datahiding.png
>>>>>
>>>>> The red data clutters the rest of the figure, and I would like to be
>>>>> able
>>>>> to
>>>>> hide it temporarily so that I can investigate the other two relations
>>>>> more
>>>>> easily.
>>>>>
>>>>> Any ideas? or alternative solutions?
>>>>
>>>> It's a nice idea, and should be doable with the pick interface we have
>>>> for all mpl artists. Unfortunately, there were a few problems in the
>>>> legend implementation which blocked the pick events from hitting the
>>>> proxy lines they contained. I just made a few changes to mpl svn HEAD
>>>> to support this, and added a new example.
>>>>
>>>>  examples/event_handling/legend_picking.py
>>>>
>>>> which I'll include below.  JJ could you review the changes to
>>>> legend.py?
>>>>
>>>> Instructions for checking out svn are at::
>>>>
>>>>
>>>> http://matplotlib.sourceforge.net/faq/installing_faq.html#install-from-svn
>>>>
>>>> Here is the example:
>>>>
>>>> """
>>>> Enable picking on the legend to toggle the legended line on and off
>>>> """
>>>> import numpy as np
>>>> import matplotlib.pyplot as plt
>>>>
>>>> t = np.arange(0.0, 0.2, 0.1)
>>>> y1 = 2*np.sin(2*np.pi*t)
>>>> y2 = 4*np.sin(2*np.pi*2*t)
>>>>
>>>> fig = plt.figure()
>>>> ax = fig.add_subplot(111)
>>>>
>>>> line1, = ax.plot(t, y1, lw=2, color='red', label='1 hz')
>>>> line2, = ax.plot(t, y2, lw=2, color='blue', label='2 hz')
>>>>
>>>> leg = ax.legend(loc='upper left', fancybox=True, shadow=True)
>>>> leg.get_frame().set_alpha(0.4)
>>>>
>>>>
>>>> lines = [line1, line2]
>>>> lined = dict()
>>>> for legline, realine in zip(leg.get_lines(), lines):
>>>>   legline.set_picker(5) # 5 pts tolerance
>>>>   lined[legline] = realine
>>>>
>>>> def onpick(event):
>>>>   legline = event.artist
>>>>   realline = lined[legline]
>>>>   vis = realline.get_visible()
>>>>   realline.set_visible(not vis)
>>>>   fig.canvas.draw()
>>>>
>>>> fig.canvas.mpl_connect('pick_event', onpick)
>>>>
>>>> plt.show()
>>>>
>>>> ------------------------------------------------------------------------------
>>>> Let Crystal Reports handle the reporting - Free Crystal Reports 2008
>>>> 30-Day
>>>> trial. Simplify your report design, integration and deployment - and
>>>> focus
>>>> on
>>>> what you do best, core application coding. Discover what's new with
>>>> Crystal Reports now. http://p.sf.net/sfu/bobj-july
>>>> _______________________________________________
>>>> Matplotlib-users mailing list
>>>> Mat...@li...
>>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>>>
>>>>
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Hiding-data-via-legend-tp24802219p25531267.html
>>> Sent from the matplotlib - users mailing list archive at Nabble.com.
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
>>> is the only developer event you need to attend this year. Jumpstart your
>>> developing skills, take BlackBerry mobile applications to market and stay
>>> ahead of the curve. Join us from November 9&#45;12, 2009. Register
>>> now&#33;
>>> http://p.sf.net/sfu/devconf
>>> _______________________________________________
>>> Matplotlib-users mailing list
>>> Mat...@li...
>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>>
>>
>> ------------------------------------------------------------------------------
>> Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
>> is the only developer event you need to attend this year. Jumpstart your
>> developing skills, take BlackBerry mobile applications to market and stay
>> ahead of the curve. Join us from November 9&#45;12, 2009. Register
>> now&#33;
>> http://p.sf.net/sfu/devconf
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>>
>
> --
> View this message in context: http://www.nabble.com/Hiding-data-via-legend-tp24802219p25633860.html
> Sent from the matplotlib - users mailing list archive at Nabble.com.
>
>
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart your
> developing skills, take BlackBerry mobile applications to market and stay
> ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
> http://p.sf.net/sfu/devconf
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
12 messages has been excluded from this view by a project administrator.

Showing results of 480

<< < 1 2 3 4 5 6 .. 20 > >> (Page 4 of 20)
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /