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


Showing results of 461

1 2 3 .. 19 > >> (Page 1 of 19)
From: Juan F. <fi...@ya...> - 2009年04月30日 23:58:31
Thanks Ryan, just what I needed.
Juan
--- On Thu, 4/30/09, Ryan May <rm...@gm...> wrote:
> From: Ryan May <rm...@gm...>
> Subject: Re: [Matplotlib-users] margins in figures
> To: fi...@ya...
> Date: Thursday, April 30, 2009, 9:59 PM
> On Thu, Apr 30, 2009 at 3:46 PM, Juan Fiol
> <fi...@ya...> wrote:
> 
> >
> > Hi, I am trying to control the amount of margin (white
> space) around the
> > figures (mainly for savefig) but could not find any
> information. Any tips?
> 
> 
> 
> Look at pyplot.subplots_adjust()
> 
> Ryan
> 
> -- 
> Ryan May
> Graduate Research Assistant
> School of Meteorology
> University of Oklahoma
> Sent from Norman, Oklahoma, United States
 
From: Christopher B. <Chr...@no...> - 2009年04月30日 22:57:07
Eric Firing wrote:
> Split the command up:
> p = Circle(...)
> ax.add_patch(p, ...)
> 
> (add_* could be modified to return the reference; maybe this would be 
> worthwhile.)
+1
-- 
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chr...@no...
From: Eric F. <ef...@ha...> - 2009年04月30日 22:13:42
Ng, Enrico wrote:
> The rotation and resetting of the labels isn't a big issue.
> The issues is when I reverse the direction. Matplotlib seems to only
> want to plot in an anti-clockwise direction. I can transform the data
> to be backwards so that it looks ok, however when it tries to connect
> the start and end points, it goes back around and draws a circle instead
> of just connecting the two points using a straight line. 
What version of mpl are you using? This sounds like behavior that is 
not current.
Eric
> 
> On Tuesday 21 April 2009 08:36:35 Michler, Matthias wrote:
> Hi Enrico,
> 
> I'm afraid that this functionality is missing in matplotlib, but I'm not
> an
> expert so there is still hope that this can be easily achieved.
> 
> A work around, that comes to my mind is resetting the label values using
> an
> idea from another mail on this list
> ( thetagrids( range(0,360,45), ('E', 'NE', 'N','NW', 'W', 'SW', 'S',
> 'SE') ) )
> 
> label_values = [item % 360 for item in range(90, -260, -45)]
> thetagrids( range(0,360,45), label_values)
> 
> and using some well defined (linear) transformation for plotting -
> translating
> your data to the actual tick positions and corresponding labels.
> 
> best regards Matthias
> 
> ------------------------------------------------------------------------------
> Register Now & Save for Velocity, the Web Performance & Operations 
> Conference from O'Reilly Media. Velocity features a full day of 
> expert-led, hands-on workshops and two days of sessions from industry 
> leaders in dedicated Performance & Operations tracks. Use code vel09scf 
> and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Ng, E. <enr...@lm...> - 2009年04月30日 21:37:19
The rotation and resetting of the labels isn't a big issue.
The issues is when I reverse the direction. Matplotlib seems to only
want to plot in an anti-clockwise direction. I can transform the data
to be backwards so that it looks ok, however when it tries to connect
the start and end points, it goes back around and draws a circle instead
of just connecting the two points using a straight line. 
On Tuesday 21 April 2009 08:36:35 Michler, Matthias wrote:
Hi Enrico,
I'm afraid that this functionality is missing in matplotlib, but I'm not
an
expert so there is still hope that this can be easily achieved.
A work around, that comes to my mind is resetting the label values using
an
idea from another mail on this list
( thetagrids( range(0,360,45), ('E', 'NE', 'N','NW', 'W', 'SW', 'S',
'SE') ) )
label_values = [item % 360 for item in range(90, -260, -45)]
thetagrids( range(0,360,45), label_values)
and using some well defined (linear) transformation for plotting -
translating
your data to the actual tick positions and corresponding labels.
best regards Matthias
From: John H. <jd...@gm...> - 2009年04月30日 21:29:11
On Thu, Apr 30, 2009 at 4:14 PM, T J <tj...@gm...> wrote:
> Fill between is for filling between two y-values over a range of
> x-values. Is there anything which fills between to x-values over a
> range of y-values?
Nothing with the ease of use of fill_between, but you can always write your
own PolyCollection, which is what fill_between does (see the function
implementation for details) or create a Polygon for a simple region. My use
cases are typically in the time series world where I have datetime on the
x-axis and some range of values on the y. If folks think it is sufficiently
useful to have a fill_betweenx function with a similar interface, you could
probably fairly easy port fill_between to fill_betweenx.
 http://matplotlib.sourceforge.net/faq/howto_faq.html#contributing-howto
JDH
From: T J <tj...@gm...> - 2009年04月30日 21:14:30
Fill between is for filling between two y-values over a range of
x-values. Is there anything which fills between to x-values over a
range of y-values?
From: Ryan M. <rm...@gm...> - 2009年04月30日 21:00:45
On Thu, Apr 30, 2009 at 3:46 PM, Juan Fiol <fi...@ya...> wrote:
>
> Hi, I am trying to control the amount of margin (white space) around the
> figures (mainly for savefig) but could not find any information. Any tips?
Look at pyplot.subplots_adjust()
Ryan
-- 
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma
Sent from Norman, Oklahoma, United States
From: Juan F. <fi...@ya...> - 2009年04月30日 20:46:14
Hi, I am trying to control the amount of margin (white space) around the figures (mainly for savefig) but could not find any information. Any tips? Thanks, Juan
 
From: John H. <jd...@gm...> - 2009年04月30日 20:44:45
Attachments: backend_emf.py
On Wed, Apr 29, 2009 at 3:51 AM, Gert-Jan <gj_...@ho...> wrote:
>
> Hey there,
>
> In my application I'd like to export plots as Enhanced Metafiles (.emf).
> After finding out that saving created plots as EMF generates an error, I
> http://www.nabble.com/EMF-export-doesn%27t-work-td22618867.html read that
> emf is no longer supported . Then I tried to
> http://www.nabble.com/How-to-add-a-new-backend--td20089848.html#a20091178
> manually enable exporting as EMF , but matplit.use('emf') generates a
> NotImplementedError.
>
> So, I'd like to know if someone happens to know of a simple method to
> reimplement the support for EMF files.
>
> Thanks in advance for your time and effort!
The syntax is
 matplotlib.use('module://backend_emf')
if backend_emf.py is in your PYTHONPATH. There is no guarantee that this
module will work with your version of matplotlib, so you may need to do some
work porting it to the latest backend API.
JDH
From: Michael D. <md...@st...> - 2009年04月30日 17:21:26
The mathtext engine (by default at least) uses the Computer Modern 
fonts. Using a custom font, such as Tahoma, requires manual configuration.
Mike
sordnay wrote:
> Thanks for the quick answer, 
> I cant check now, it's also the reason why i didn't post the exact error
> code, 
> but the program is supposed to use only Tahoma ttf font which I included on
> the data files.
>
>
> Michael Droettboom-3 wrote:
> 
>> It sounds like it is not finding the appropriate fonts. Have you tried 
>> installing (in C:\Windows\Fonts) all of the ttf files included with 
>> matplotlib?
>>
>> If that's not it, can you provide a complete traceback with the exact 
>> error message?
>>
>> Mike
>>
>> -- 
>> Michael Droettboom
>> Science Software Branch
>> Operations and Engineering Division
>> Space Telescope Science Institute
>> Operated by AURA for NASA
>>
>>
>> ------------------------------------------------------------------------------
>> Register Now & Save for Velocity, the Web Performance & Operations 
>> Conference from O'Reilly Media. Velocity features a full day of 
>> expert-led, hands-on workshops and two days of sessions from industry 
>> leaders in dedicated Performance & Operations tracks. Use code vel09scf 
>> and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf
>> _______________________________________________
>> 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: sordnay <so...@gm...> - 2009年04月30日 17:01:43
Thanks for the quick answer, 
I cant check now, it's also the reason why i didn't post the exact error
code, 
but the program is supposed to use only Tahoma ttf font which I included on
the data files.
Michael Droettboom-3 wrote:
> 
> It sounds like it is not finding the appropriate fonts. Have you tried 
> installing (in C:\Windows\Fonts) all of the ttf files included with 
> matplotlib?
> 
> If that's not it, can you provide a complete traceback with the exact 
> error message?
> 
> Mike
> 
> -- 
> Michael Droettboom
> Science Software Branch
> Operations and Engineering Division
> Space Telescope Science Institute
> Operated by AURA for NASA
> 
> 
> ------------------------------------------------------------------------------
> Register Now & Save for Velocity, the Web Performance & Operations 
> Conference from O'Reilly Media. Velocity features a full day of 
> expert-led, hands-on workshops and two days of sessions from industry 
> leaders in dedicated Performance & Operations tracks. Use code vel09scf 
> and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
> 
-- 
View this message in context: http://www.nabble.com/mathtext-and-py2exe-tp23319691p23320374.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Jae-Joon L. <lee...@gm...> - 2009年04月30日 17:00:00
Is there any specific reason that you have to use figlegend, instead
of "legend"?
I'm asking this because the "legend" command automatically collect all
the relevant information for you, i.e., you can just do
 legend()
Of course the legend is displayed inside the axes unlike the figlegend.
If you're running the svn version of the mpl, you may place the (axes)
legend at the figure corner by doing
 l = legend()
 l.set_bbox_to_anchor([0, 0, 1, 1], transform=gcf().transFigure)
Anyhow,
# mylables=ax.get_line_labels() I WISH THIS WAS POSSIBLE !!
You can simply do
mylables= [l.get_label() for l in mylines]
Regards,
-JJ
On Thu, Apr 30, 2009 at 12:09 PM, Andrew Romero <rom...@ya...> wrote:
>
> Hi
>
> In one part of my script I plot some lines
> and assign labels to the lines.
>
> Later in the script I create a figure legend.
>
> How do I get the labels, that I assigned at plot-time, to
> be used in the legend? Currently I am manually
> specifying the legend labels.
>
>
> # Plot some lines ... set values for the labels
> ax.plot(r.date, r.FSA, label='FSA-Load-Pct')
> ax.plot(r.date, r.FSB, label='FSB-Load-Pct')
> ax.plot(r.date, r.Heap, label='Heap-Use-Pct')
> .
> .
> .
> .
> .
> # now setup the legend for the figure
> # It would be nice to be able to use the labels already assigned
> # to the lines .. rather than having to manually respecify the labels for
> # the legend
>
> mylines=ax.get_lines()
> # mylables=ax.get_line_labels() I WISH THIS WAS POSSIBLE !!
>
> # this is one line may wrap in the email message
> figlegend = fig0.legend(mylines, ('FSA-Load-Pct','FSB-Load-Pct','Heap-Use-Pct'), loc=(0.5,0.01), prop=matplotlib.font_manager.FontProperties(size='smaller'))
>
>
>
> Thanks
> Andy
>
>
>
>
>
> ------------------------------------------------------------------------------
> Register Now & Save for Velocity, the Web Performance & Operations
> Conference from O'Reilly Media. Velocity features a full day of
> expert-led, hands-on workshops and two days of sessions from industry
> leaders in dedicated Performance & Operations tracks. Use code vel09scf
> and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: Jae-Joon L. <lee...@gm...> - 2009年04月30日 16:36:05
Thomas,
As John suggested before, please check if the size differences go away
if you use the same dpi, actually dpi=72.
After some quick look, it seems that the osx backend does not scale
the font size correctly respecting the dpi.
At line 124 of bacend_macosx.py,
 size = prop.get_size_in_points()
 weight = prop.get_weight()
 style = prop.get_style()
 gc.draw_text(x, y, unicode(s), family, size, weight, style, angle)
My quick guess is that replacing
 size => size*self.dpi/72.
in the last call may solve the problem. Since I don't use the osx
backend, I wonder if others can test this.
-JJ
On Thu, Apr 30, 2009 at 9:32 AM, Michael Droettboom <md...@st...> wrote:
> I forwarded this message to Michiel de Hoon, the author of the Mac OS-X
> backend, in case he has any thoughts.
>
> Mike
>
> Thomas Robitaille wrote:
>>
>> Hi Jae-Jong and John,
>>
>> Thanks for your replies! While experimenting with this to send
>> screenshots, I realized that my default backend was set to MacOSX, not
>> WXAgg. The WXAgg output to the screen actually agrees with the PNG output in
>> terms of font sizes. But the font sizes differ between the MacOSX and WXAgg
>> backends. Attached are screenshots using the MacOSX and WXAgg backends. You
>> can see the font size is different. Is this a bug?
>>
>> Thanks,
>>
>> Thomas
>>
>>
>>
>> ------------------------------------------------------------------------
>>
>>
>> ------------------------------------------------------------------------
>>
>>
>> On 29 Apr 2009, at 00:24, Jae-Joon Lee wrote:
>>
>>> On Tue, Apr 28, 2009 at 11:09 PM, John Hunter <jd...@gm...> wrote:
>>>>
>>>> If you want the relative fontsizes in the figure window and saved figure
>>>> to
>>>> agree, pass the same "dpi" to the figure command and savefig command.
>>>
>>> John,
>>> I thought the font size (which is specified in points) is independent
>>> of dpi, i.e., font size in "pixel" actually scales with the dpi. I
>>> think it should be filed as a bug if the relative font size depends on
>>> the dpi.
>>>
>>> Anyhow, I just did a quick test and the (relative) font size does not
>>> seem to vary with dpi.
>>>
>>> Thomas,
>>> What version of mpl are you using?
>>> With the mpl from the svn trunk, I don't see any significant change as
>>> you described.
>>> The WxAgg figure and the png output are actually drawn by an identical
>>> backend, so there should be no significant difference. There can be
>>> some subtle difference due to different dpi, but I don't see a
>>> difference as large as 30%. Can you post a some sample images? i.e., a
>>> screenshot of WxAgg figure and the png output.
>>>
>>> I can see that the text in pdf output occupies a bit larger area than
>>> png (when usetex=False), but, to me, this seems to be due to different
>>> amount of kernings (it seems that no kerning is applied for pdf text)
>>> instead of different font size.
>>>
>>> So, can you first check if the difference goes away when you use same
>>> dpi as John suggested? And if that is the case, can you try the latest
>>> svn and check if the relative font size still depends on the dpi?
>>>
>>> Regards,
>>>
>>> -JJ
>>
>> ------------------------------------------------------------------------
>>
>>
>> ------------------------------------------------------------------------------
>> Register Now & Save for Velocity, the Web Performance & Operations
>> Conference from O'Reilly Media. Velocity features a full day of expert-led,
>> hands-on workshops and two days of sessions from industry leaders in
>> dedicated Performance & Operations tracks. Use code vel09scf and Save an
>> extra 15% before 5/3. http://p.sf.net/sfu/velocityconf
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> 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: Michael D. <md...@st...> - 2009年04月30日 16:30:06
It sounds like it is not finding the appropriate fonts. Have you tried 
installing (in C:\Windows\Fonts) all of the ttf files included with 
matplotlib?
If that's not it, can you provide a complete traceback with the exact 
error message?
Mike
sordnay wrote:
> hello,
> I have written a program which uses matplotlib to plot some figures, it uses
> mathtext to add some special chars (basically just the square on
> acceleration units), and the program works just fine, but using py2exe to
> build a windows executable, it fails somewhere drawing that square symbol. 
> The error the program yields is something like "unable to convert string to
> unicode". 
> Has anyone experienced this kind of problem with mathtext and py2exe or has
> any clue what is needed to be included at the py2exe setup.py to fix it?
> I know this is not the best place for an answer, but I couldn't find where
> to get help on py2exe site :-/ so if anyone could help...
> Thanks a lot.
>
> 
-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA
From: sordnay <so...@gm...> - 2009年04月30日 16:23:37
hello,
I have written a program which uses matplotlib to plot some figures, it uses
mathtext to add some special chars (basically just the square on
acceleration units), and the program works just fine, but using py2exe to
build a windows executable, it fails somewhere drawing that square symbol. 
The error the program yields is something like "unable to convert string to
unicode". 
Has anyone experienced this kind of problem with mathtext and py2exe or has
any clue what is needed to be included at the py2exe setup.py to fix it?
I know this is not the best place for an answer, but I couldn't find where
to get help on py2exe site :-/ so if anyone could help...
Thanks a lot.
-- 
View this message in context: http://www.nabble.com/mathtext-and-py2exe-tp23319691p23319691.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Andrew R. <rom...@ya...> - 2009年04月30日 16:10:50
Hi
In one part of my script I plot some lines
and assign labels to the lines.
Later in the script I create a figure legend.
How do I get the labels, that I assigned at plot-time, to
be used in the legend? Currently I am manually
specifying the legend labels.
# Plot some lines ... set values for the labels
ax.plot(r.date, r.FSA, label='FSA-Load-Pct')
ax.plot(r.date, r.FSB, label='FSB-Load-Pct')
ax.plot(r.date, r.Heap, label='Heap-Use-Pct')
.
.
.
.
.
# now setup the legend for the figure
# It would be nice to be able to use the labels already assigned
# to the lines .. rather than having to manually respecify the labels for
# the legend
mylines=ax.get_lines()
# mylables=ax.get_line_labels() I WISH THIS WAS POSSIBLE !!
# this is one line may wrap in the email message
figlegend = fig0.legend(mylines, ('FSA-Load-Pct','FSB-Load-Pct','Heap-Use-Pct'), loc=(0.5,0.01), prop=matplotlib.font_manager.FontProperties(size='smaller'))
Thanks
Andy
 
From: Andres L. <and...@ut...> - 2009年04月30日 15:19:53
John, that's exactly what I wanted, thanks.
Andres
John Hunter wrote:
>
>
> On Wed, Apr 29, 2009 at 10:54 AM, John Hunter <jd...@gm... 
> <mailto:jd...@gm...>> wrote:
>
>
>
> fill_between does not currently support masked arrays, but I think
> we could easily extend it to support the mask using the existing
> support for the "where" kwarg. For now, does this behave like you
> expect?
>
> valid = ~(edatmax.mask & edatmax.mask )
> 
> pylab.fill_between(xtelg,edatmax,edatmin,facecolor='green',alpha='0.3',
> where=valid)
> 
>
>
> Oops -- meant
>
> valid = ~(edatmin.mask & edatmax.mask )
>
> JDH
>
From: Mark L. <lar...@gm...> - 2009年04月30日 14:03:50
> You may use the bbox attribute of the axes.
> For example, ax.bbox.extents gives you the x,y coordinates of the
> lowerleft and topright corners.
Perfect, thanks so much.
From: Marco G. <ma...@ga...> - 2009年04月30日 09:57:13
Thanks, this works well. My current result can be seen at [1]. The x
data is real numbers, while the y data is integers; so I set the
number of y-bins to the range of the y data.
What I'd like to do now is scale the plot such that for every y value
the sum of the intensities are equal. Let count[j] be the number of
data points having y value equal to j, and let product be the product
of all non-zero count[j]. One possible solution would be to put in
each data point (product / count[j]) times, but since product is far
too large this won't work (even the lcm is too huge). Is there a
better solution to do this using matplotlib?
[1] http://people.cs.uct.ac.za/~mgallott/resources/plot.png
Thanks
Marco
On Wed, Apr 29, 2009 at 5:29 PM, John Hunter <jd...@gm...> wrote:
>
>
> On Wed, Apr 29, 2009 at 9:59 AM, marcog <ma...@ga...> wrote:
>>
>> Hi
>>
>> I have a set of 2 dimensional data that I would like to form a histogram
>> of.
>> Each data point is defined by an x and y variable. So essentially what I
>> would like to obtain is a "row" of histograms as produced by the plot.hist
>> function, stacking them next to one another in a single 3D plot. For
>> example, something like [1], but I don't need it to be interpolated.
>>
>> [1] http://www.mathworks.com/matlabcentral/fx_files/14205/1/hist.jpg
>
>
> hexbin may be what you are looking for, which does a 2D colormapped
> histogram, with an optional reduce function so you can specify the intensity
> function over the bins
>
>
> http://matplotlib.sourceforge.net/api/axes_api.html#matplotlib.axes.Axes.hexbin
>  http://matplotlib.sourceforge.net/examples/pylab_examples/hexbin_demo.html
>
> http://matplotlib.sourceforge.net/examples/pylab_examples/hexbin_demo2.html
>
> JDH
>
-- 
Marco Gallotta
MSc Student | SACO Scientific Committee | ACM ICPC Coach
Department of Computer Science, University of Cape Town
people.cs.uct.ac.za/~mgallott | marco-za.blogspot.com
marco AT gallotta DOT co DOT za | 073 170 4444 | 021 552 2731
From: Ondrej C. <on...@ce...> - 2009年04月30日 05:15:20
On Fri, Apr 24, 2009 at 1:10 PM, Sandro Tosi <mo...@de...> wrote:
> Hi Ondrej,
> nice to see you here :)
Nice to see you too! :)
>
> On Fri, Apr 24, 2009 at 22:02, Ondrej Certik <on...@ce...> wrote:
>> Hi,
>>
>> is there a way to have one plot with two functions, one using some
>> scale, the other one a different scale and show for example one scale
>> on the left, the other scale on the right?
>
> sure, twinx() is what you're looking for; here is a simple example:
>
> import matplotlib.pyplot as plt
> import numpy as np
> x = np.arange(0., np.e, 0.01)
> y1 = np.exp(-x)
> y2 = np.log(x)
> fig = plt.figure()
> ax1 = fig.add_subplot(111)
> ax1.plot(x, y1)
> ax1.set_ylabel('Y values for exp(-x)')
> ax2 = ax1.twinx()
> ax2.plot(x, y2, 'r')
> ax2.set_xlim([0,np.e])
> ax2.set_ylabel('Y values for ln(x)')
> ax2.set_xlabel('Same X for both exp(-x) and ln(x)')
>
> The values on X has to be of the same scale, tough, else the graph
> would look really weird.
Thanks a lot for the code. That worked. I was meeting some deadline,
so I forgot to reply that it worked.
Thanks Ryan and Jouni as well!
Ondrej
From: Thomas R. <tho...@gm...> - 2009年04月30日 03:54:53
Attachments: wxagg.png macosx.png
Hi Jae-Jong and John,
Thanks for your replies! While experimenting with this to send 
screenshots, I realized that my default backend was set to MacOSX, not 
WXAgg. The WXAgg output to the screen actually agrees with the PNG 
output in terms of font sizes. But the font sizes differ between the 
MacOSX and WXAgg backends. Attached are screenshots using the MacOSX 
and WXAgg backends. You can see the font size is different. Is this a 
bug?
Thanks,
Thomas
From: Jae-Joon L. <lee...@gm...> - 2009年04月30日 02:04:37
You may use the bbox attribute of the axes.
For example, ax.bbox.extents gives you the x,y coordinates of the
lowerleft and topright corners.
-JJ
On Wed, Apr 29, 2009 at 4:06 PM, Mark Larsen <lar...@gm...> wrote:
> It's been a while, please allow me to bump this...
>
>> Sorry. I use matplotlib to create PNGs graphics for display on a
>> web-page. I want to make the plots zoom-able. I'll use javascript to
>> capture the pixel positions of the user's selected zoom region on the
>> PNG plot. I'll then translate this into the coordinate system on the
>> plot and redraw it with a new x, y range. I'm having trouble
>> translating the initial axises into the pixel positions (essentially
>> where they are on the PNG image).
>>
>> For example, I use the following code to map point positions from the
>> coordinate system to pixel positions. I use an img map <MAP> to
>> provide interaction with the actual lines.
>>
>> [CODE]
>>
>> lineObj = plt.plot(Xs,Ys,marker='o')[0]
>> path, affine = lineObj._transformed_path.get_transformed_points_and_affine()
>> path = affine.transform_path(path)
>> for real,pixel in zip(lineObj.get_xydata(),path.vertices):
>> ## write <AREA> tag for each point
>>
>> [/CODE]
>>
>> I'd like to get information similar to this for the axis of the plot.
>>
>> Thanks.
>>
>
> ------------------------------------------------------------------------------
> Register Now & Save for Velocity, the Web Performance & Operations
> Conference from O'Reilly Media. Velocity features a full day of
> expert-led, hands-on workshops and two days of sessions from industry
> leaders in dedicated Performance & Operations tracks. Use code vel09scf
> and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: Eric F. <ef...@ha...> - 2009年04月30日 01:53:29
Thomas Robitaille wrote:
> Thanks!
> 
> Is there an easy way to keep a reference to patches? I notice that for 
> example
> 
> p = ax.add_patch(Circle((0.5,0.5),radius=0.5))
> 
> does not work (p is not a reference to the patch). Is there a way to 
> keep a reference so I can update the properties of the patch at a later 
> time?
Split the command up:
p = Circle(...)
ax.add_patch(p, ...)
(add_* could be modified to return the reference; maybe this would be 
worthwhile.)
Eric
> 
> Cheers,
> 
> Thomas
> 
> On 29 Apr 2009, at 21:13, Eric Firing wrote:
> 
>> Thomas Robitaille wrote:
>>> Hi,
>>> Is there an easy way to draw a patch or a patchcollection such that 
>>> it always stays at the same relative position in a set of axes, 
>>> rather than at the same pixel position? So for example, I would want 
>>> to plot it at (0.1,0.1) relative to the axes, and if I zoom in I 
>>> would still want it to stay at (0.1,0.1)
>>
>> With ipython -pylab:
>>
>> ax = gca()
>> ax.fill([0.1, 0.2, 0.15], [0.1, 0.1, 0.15], transform=ax.transAxes)
>> draw()
>>
>> then pan, zoom at will.
>>
>> Eric
>>
> 
From: Thomas R. <tho...@gm...> - 2009年04月30日 01:17:51
Thanks!
Is there an easy way to keep a reference to patches? I notice that for 
example
p = ax.add_patch(Circle((0.5,0.5),radius=0.5))
does not work (p is not a reference to the patch). Is there a way to 
keep a reference so I can update the properties of the patch at a 
later time?
Cheers,
Thomas
On 29 Apr 2009, at 21:13, Eric Firing wrote:
> Thomas Robitaille wrote:
>> Hi,
>> Is there an easy way to draw a patch or a patchcollection such that 
>> it always stays at the same relative position in a set of axes, 
>> rather than at the same pixel position? So for example, I would 
>> want to plot it at (0.1,0.1) relative to the axes, and if I zoom 
>> in I would still want it to stay at (0.1,0.1)
>
> With ipython -pylab:
>
> ax = gca()
> ax.fill([0.1, 0.2, 0.15], [0.1, 0.1, 0.15], transform=ax.transAxes)
> draw()
>
> then pan, zoom at will.
>
> Eric
>
From: Eric F. <ef...@ha...> - 2009年04月30日 01:13:21
Thomas Robitaille wrote:
> Hi,
> 
> Is there an easy way to draw a patch or a patchcollection such that it 
> always stays at the same relative position in a set of axes, rather 
> than at the same pixel position? So for example, I would want to plot 
> it at (0.1,0.1) relative to the axes, and if I zoom in I would still 
> want it to stay at (0.1,0.1)
With ipython -pylab:
ax = gca()
ax.fill([0.1, 0.2, 0.15], [0.1, 0.1, 0.15], transform=ax.transAxes)
draw()
then pan, zoom at will.
Eric
25 messages has been excluded from this view by a project administrator.

Showing results of 461

1 2 3 .. 19 > >> (Page 1 of 19)
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 によって変換されたページ (->オリジナル) /