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




Showing 22 results of 22

From: Jae-Joon L. <lee...@gm...> - 2009年06月05日 22:33:37
John,
These ideas have been part of motivation behind my axes_grid toolkit.
In the module documentation of
"lib/mpl_toolkits/axes_grid/axislines.py", I tried to briefly explain
what I wanted and what I implemented, although the explanation is very
far from complete (also some examples are found in
http://matplotlib.sourceforge.net/mpl_toolkits/axes_grid/users/overview.html#axisline
). Note that my ultimate goal was to support the curvelinear
coordinate system, as demonstrated in my recent example
(examples/axes_grid/demo_curvelinear_grid.py).
And my hope is that, if we're going to this direction and somehow
expand the "spines" to support these ideas, please make it possible to
customize and expand although only the basic features are supported by
the vanilla mpl. For example, in curvelinear coordinate, ticks can
have arbitrary angles, so I hope that the tickstyles are not strictly
limited to [TICKLEFT, TICKRIGHT, TICKUP, TICKDOWN] by design. It would
be great if there is a chance to discuss about the overall design
before implementing something in this regard.
My current implementation in axes_grid toolkit became rather
complicated, and some of them are implemented in quick and dirty ways.
However, I guess it would be helpful to go over how thing are
currently implemented in axes_grid toolkit and further discuss how
we're going to do this within the mpl. I'll try to write up short
documentation about my design during this weekend.
Regards,
-JJ
On Fri, Jun 5, 2009 at 1:07 PM, John Hunter<jd...@gm...> wrote:
> On Fri, Jun 5, 2009 at 11:44 AM, Andrew Straw<str...@as...> wrote:
>
>> I think this would be a good direction, as well. It would also allow
>> disabling the tick mark labels in some axes that share the same axis --
>> because the ticks/labels would belong to the spine, which itself
>> wouldn't (necessarily) be shared.
>>
>> I can't promise anything, but this may be a solution to the issues that
>> Jae-Joon pointed out w.r.t loglog plots in the spine implementation
>> (although I suspect they are more general). I'll take a look at it,
>> although I can't say exactly when I'll do so -- hopefully within the
>> coming week.
>
> If you go this route, you may want to look at abolishing the Tick
> class entirely -- once the ticks are associated with a spine, we will
> not need the tick1line, tick2line, label1, label2 instances. We can
> draw all the ticks along a given spine with a single Line2D object
> using the marker styles TICKLEFT, TICKRIGHT, TICKUP, and TICKDOWN. We
> really do not need heterogeneous properties along a given spine, so we
> are paying a lot to have separate artist instances for each of these
> things. The tick labels will be a little harder since Text is so
> complicated, so you might want to punt at the outset and just have the
> spine hold a list of Text instances, and down the road we can think
> about a more efficient text collection if necessary.
>
> Thinking out loud.... But for nonlinear coordinate systems, where
> ticks may be oriented in different directions, the single Line2D idea
> may not work so tread cautiously -- perhaps a line collection for the
> tick lines....
>
> I am willing to have some breakage in support of this, though we can
> try to make the top level axes methods accessor (e get_xticklabels)
> do the intuitive thing.
>
> JDH
>
From: Gökhan S. <gok...@gm...> - 2009年06月05日 19:58:42
Hi,
I sometimes create matplotlib plots without any labels on them -figures
only. Then I add appropriate titles and/or labels using either MS Word or OO
Writer.
A few times used GIMP too to add additional texts. When I can't easily
figure out things in matplotlib this method turns out helpful to accomplish
the task.
Gökhan
On Fri, Jun 5, 2009 at 2:32 PM, Yves-Alexandre <yve...@ho...>wrote:
> Hi,
>
> A quick (probably easy) question: how do you do a label in two lines and
> with both lines centered?
>
> xlabel('first line \n second line') don't center both :(
>
> best,
>
> -Yva.
>
>
> ------------------------------------------------------------------------------
> OpenSolaris 2009.06 is a cutting edge operating system for enterprises
> looking to deploy the next generation of Solaris that includes the latest
> innovations from Sun and the OpenSource community. Download a copy and
> enjoy capabilities such as Networking, Storage and Virtualization.
> Go to: http://p.sf.net/sfu/opensolaris-get
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: Ryan M. <rm...@gm...> - 2009年06月05日 19:50:37
On Fri, Jun 5, 2009 at 2:32 PM, Yves-Alexandre <yve...@ho...>wrote:
> Hi,
>
> A quick (probably easy) question: how do you do a label in two lines and
> with both lines centered?
>
> xlabel('first line \n second line') don't center both :(
Try removing the spaces, that makes it look good for me:
xlabel('first line\nsecond line')
Ryan
-- 
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma
Sent from Norman, Oklahoma, United States
From: Yves-Alexandre <yve...@ho...> - 2009年06月05日 19:33:37
Hi,
A quick (probably easy) question: how do you do a label in two lines and 
with both lines centered?
xlabel('first line \n second line') don't center both :(
best,
-Yva.
From: Young, K. <kar...@uc...> - 2009年06月05日 18:06:47
Hi Eric,
Thanks much - I'll try that.
________________________________________
From: Eric Firing [ef...@ha...]
Sent: Friday, June 05, 2009 10:43 AM
To: Young, Karl
Cc: John Hunter; mat...@li...
Subject: Re: [Matplotlib-users] consistent colors between imshow and scatter
Young, Karl wrote:
> Thanks for the tip and sorry I didn't include a complete code
> snippet; the current code involves images (scipy.ndimage) and
> clustering code and I thought that was a little too much too include;
> I'll try to extract something simpler. I guess the main question is
> how to use a set of integers to index a color space consistently for
> both scatter and imshow but I'll try to come up with a simple
> example. Thanks agan.
>
Karl,
It sounds like you need to specify the norm=colors.NoNorm() argument.
http://matplotlib.sourceforge.net/api/colors_api.html?highlight=nonorm#matplotlib.colors.NoNorm
 Then if your data are integers (typed as integers, not just taking
integer values), they will be interpreted as indices into the color
table. You will probably also want to generate that table yourself and
specify it via the cmap=my_cmap kwarg. If you have only a few values,
then you may want to generate it as a colors.ListedColormap:
http://matplotlib.sourceforge.net/api/colors_api.html?highlight=listedcolormap#matplotlib.colors.ListedColormap
http://matplotlib.sourceforge.net/examples/api/colorbar_only.html?highlight=listedcolormap
It looks like we don't have any good examples sitting around showing the
use of NoNorm; but try it anyway.
Eric
From: Eric F. <ef...@ha...> - 2009年06月05日 17:44:00
Young, Karl wrote:
> Thanks for the tip and sorry I didn't include a complete code
> snippet; the current code involves images (scipy.ndimage) and
> clustering code and I thought that was a little too much too include;
> I'll try to extract something simpler. I guess the main question is
> how to use a set of integers to index a color space consistently for
> both scatter and imshow but I'll try to come up with a simple
> example. Thanks agan.
> 
Karl,
It sounds like you need to specify the norm=colors.NoNorm() argument.
http://matplotlib.sourceforge.net/api/colors_api.html?highlight=nonorm#matplotlib.colors.NoNorm
 Then if your data are integers (typed as integers, not just taking 
integer values), they will be interpreted as indices into the color 
table. You will probably also want to generate that table yourself and 
specify it via the cmap=my_cmap kwarg. If you have only a few values, 
then you may want to generate it as a colors.ListedColormap:
http://matplotlib.sourceforge.net/api/colors_api.html?highlight=listedcolormap#matplotlib.colors.ListedColormap
http://matplotlib.sourceforge.net/examples/api/colorbar_only.html?highlight=listedcolormap
It looks like we don't have any good examples sitting around showing the 
use of NoNorm; but try it anyway.
Eric
From: Eric F. <ef...@ha...> - 2009年06月05日 17:35:16
Markus Feldmann wrote:
> Hi All,
> 
> i try to get a colorbar to work with:
> if not hasattr(self, 'subplot3'):
> self.subplot3 = self.figure.add_subplot(111)
> self.subplot3.grid(True)
> x,y,z = self.computehistogramm(min,min+self.maxitems)
> X,Y = meshgrid(x,y)
> plot = self.subplot3.pcolor(Y,X,z)
> self.figure.colorbar(plot)
> 
> but the x and y axis are interchanged, like this:
> 
> 
> X
> |
> |
> |
> |
> |
> o-------------Y
> 
> But i want this:
> Y
> |
> |
> |
> |
> |
> o-------------X
> 
> So how can i change this ?
> the x and y data also depends on Z, so when i change x<-->y then i have
> change z too ?
> 
I don't understand what your question has to do with the colorbar; but 
in anything like pcolor, if you swap X and Y, then at the same time you 
need to transpose Z.
http://matplotlib.sourceforge.net/api/pyplot_api.html#axes-pcolor-grid-orientation
Eric
> Any hints for me ?
> 
> As i read in the examples and in the docu this shoul be right,
> self.subplot3.pcolor(x,y,z)
> 
> But then my x and y data are wrong assigned to z, so i wrote
> self.subplot3.pcolor(y,x,z)
> 
> How to change my code so x and y are right assigned to z and i get this:
> Y
> |
> |
> |
> |
> |
> o-------------X
> 
> regards Markus
> 
> 
> ------------------------------------------------------------------------------
> OpenSolaris 2009.06 is a cutting edge operating system for enterprises 
> looking to deploy the next generation of Solaris that includes the latest 
> innovations from Sun and the OpenSource community. Download a copy and 
> enjoy capabilities such as Networking, Storage and Virtualization. 
> Go to: http://p.sf.net/sfu/opensolaris-get
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: John H. <jd...@gm...> - 2009年06月05日 17:07:05
On Fri, Jun 5, 2009 at 11:44 AM, Andrew Straw<str...@as...> wrote:
> I think this would be a good direction, as well. It would also allow
> disabling the tick mark labels in some axes that share the same axis --
> because the ticks/labels would belong to the spine, which itself
> wouldn't (necessarily) be shared.
>
> I can't promise anything, but this may be a solution to the issues that
> Jae-Joon pointed out w.r.t loglog plots in the spine implementation
> (although I suspect they are more general). I'll take a look at it,
> although I can't say exactly when I'll do so -- hopefully within the
> coming week.
If you go this route, you may want to look at abolishing the Tick
class entirely -- once the ticks are associated with a spine, we will
not need the tick1line, tick2line, label1, label2 instances. We can
draw all the ticks along a given spine with a single Line2D object
using the marker styles TICKLEFT, TICKRIGHT, TICKUP, and TICKDOWN. We
really do not need heterogeneous properties along a given spine, so we
are paying a lot to have separate artist instances for each of these
things. The tick labels will be a little harder since Text is so
complicated, so you might want to punt at the outset and just have the
spine hold a list of Text instances, and down the road we can think
about a more efficient text collection if necessary.
Thinking out loud.... But for nonlinear coordinate systems, where
ticks may be oriented in different directions, the single Line2D idea
may not work so tread cautiously -- perhaps a line collection for the
tick lines....
I am willing to have some breakage in support of this, though we can
try to make the top level axes methods accessor (e get_xticklabels)
do the intuitive thing.
JDH
From: Andrew S. <str...@as...> - 2009年06月05日 16:44:26
John Hunter wrote:
> On Thu, Jun 4, 2009 at 12:16 PM, Jae-Joon Lee<lee...@gm...> wrote:
>> I hope the code below gives you some idea.
>>
>>
>> def Tc(Tf): return (5./9.)*(Tf-32)
>>
>> ax1 = subplot(111) # y-axis in F
>> ax2 = twinx() # y-axis in C
>>
>> def update_ax2(ax1):
>> y1, y2 = ax1.get_ylim()
>> ax2.set_ylim(Tc(y1), Tc(y2))
>>
>> # automatically update ylim of ax2 when ylim of ax1 changes.
>> ax1.callbacks.connect("ylim_changed", update_ax2)
>> ax1.plot([78, 79, 79, 77])
> 
> Yes, this is a cute little example. I was thinking along the lines
> Ryan was, to just plot the same data twice with twinx, but this is
> cleverer. I added it to svn as:
> examples/api/fahrenheit_celcius_scales.py
> 
> But using twinx has always been a hack. I think what we really need
> is to have each spine have it's own locator, formatter and tick
> collection (eg the natural points for Celcius ticks are different from
> the natural points for Fahrenheit ticks) and currently the left and
> right ticks of an axis share the axis locator and formatter.
> Currently the spines just draw the lines and the axes/axis handle all
> the ticks and the locators. It might be more natural to move these
> into the spine itself, and support independent
> ticks/locators/formatter for each spine, with the default being
> shared.
> 
> Andrew, did you give this any thought in the spine implementation? I
> am pretty sure it would be hard, but maybe you have a better sense of
> *how hard*. This would be a nice enhancement.
I think this would be a good direction, as well. It would also allow
disabling the tick mark labels in some axes that share the same axis --
because the ticks/labels would belong to the spine, which itself
wouldn't (necessarily) be shared.
I can't promise anything, but this may be a solution to the issues that
Jae-Joon pointed out w.r.t loglog plots in the spine implementation
(although I suspect they are more general). I'll take a look at it,
although I can't say exactly when I'll do so -- hopefully within the
coming week.
-Andrew
From: Young, K. <kar...@uc...> - 2009年06月05日 15:38:31
Thanks for the tip and sorry I didn't include a complete code snippet; the current code involves images (scipy.ndimage) and clustering code and I thought that was a little too much too include; I'll try to extract something simpler. I guess the main question is how to use a set of integers to index a color space consistently for both scatter and imshow but I'll try to come up with a simple example. Thanks agan.
________________________________________
From: John Hunter [jd...@gm...]
Sent: Friday, June 05, 2009 5:43 AM
To: Young, Karl
Cc: mat...@li...
Subject: Re: [Matplotlib-users] consistent colors between imshow and scatter
On Thu, Jun 4, 2009 at 6:38 PM, Karl Young<kar...@uc...> wrote:
>
> I have 2 float arrays of the same dimension which I use to generate a
> 3rd array, again of the same dimension, containing integers from a small
> set (I obtain the 3rd array via clustering in the 2 dimensional space of
> points obtained as values from the same location in the initial 2
> arrays). I'd like to do a scatter plot using scatter, with x-axis values
> as values from the first array, y-values as values from the second array
> and color of the points corresponding to the integer in the 3rd array
> (so far so good; I can do that much). Then I'd like to plot an image
> using imshow of the 3rd array with colors corresponding to those in the
> scatter plot. I can generate the image with imshow ok but can't the
> colors to match those in the scatter plot. Here's a snippet (assume
> array1,array2, and array3 are 2D arrays):
>
> hot()
> scatter(array1.ravel(), array2.ravel(), c =
> numpy.array(array3.ravel(),float))
> imshow(array3)
> show()
>
> The main problem is that I can't figure out how to force the plot colors
> for imshow to correspond to those in scatter. Thanks for any thought or
> suggestions. Cheers,
w/o a complete, self contained code sample that we can run and play
with on our machines, it is harder to help. Have you tried forcing
the clim to be set to the interval you want?
http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.clim
JDH
From: Jorge S. <jor...@ya...> - 2009年06月05日 14:35:47
Alan G Isaac <alan.isaac@...> writes:
<snip>
> That's all, as long as you don't mind destroying
> the Window manually. (Otherwise, you need just
> a couple more lines.)
 
Thanks, I'll give this a try.
Jorge
From: <jor...@ya...> - 2009年06月05日 13:22:29
Hi,
The matplotlib.collections.Collection documentation reads: "All properties in a collection must be sequences or scalars; if scalars, they will be converted to sequences. The property of the ith element of the collection is: prop[i % len(props)]". I had a look at the docstring documentation from ipython, but I didn't find out how the above is achieved (I am learning Python together with numpy, matplotlib, etc.). In my own code, how could I do something like this? If you point to a relevant location on the source code, that's alright. I also get confused sometimes because of the multiple (and sometimes interchangeable) ways of specifying arguments: sequences (list, tuples), numpy arrays, etc. I started using almost exclusively numpy arrays (probably due to my matlab background), but I am starting to mix a bit of everything now (depending on what "sources of inspiration" I use), so I wondered what a good guideline would be.
Thanks,
Jorge
 
From: John H. <jd...@gm...> - 2009年06月05日 13:02:47
On Thu, Jun 4, 2009 at 12:16 PM, Jae-Joon Lee<lee...@gm...> wrote:
> I hope the code below gives you some idea.
>
>
> def Tc(Tf): return (5./9.)*(Tf-32)
>
> ax1 = subplot(111) # y-axis in F
> ax2 = twinx() # y-axis in C
>
> def update_ax2(ax1):
> y1, y2 = ax1.get_ylim()
> ax2.set_ylim(Tc(y1), Tc(y2))
>
> # automatically update ylim of ax2 when ylim of ax1 changes.
> ax1.callbacks.connect("ylim_changed", update_ax2)
> ax1.plot([78, 79, 79, 77])
Yes, this is a cute little example. I was thinking along the lines
Ryan was, to just plot the same data twice with twinx, but this is
cleverer. I added it to svn as:
examples/api/fahrenheit_celcius_scales.py
But using twinx has always been a hack. I think what we really need
is to have each spine have it's own locator, formatter and tick
collection (eg the natural points for Celcius ticks are different from
the natural points for Fahrenheit ticks) and currently the left and
right ticks of an axis share the axis locator and formatter.
Currently the spines just draw the lines and the axes/axis handle all
the ticks and the locators. It might be more natural to move these
into the spine itself, and support independent
ticks/locators/formatter for each spine, with the default being
shared.
Andrew, did you give this any thought in the spine implementation? I
am pretty sure it would be hard, but maybe you have a better sense of
*how hard*. This would be a nice enhancement.
JDH
From: John H. <jd...@gm...> - 2009年06月05日 12:52:02
On Thu, Jun 4, 2009 at 6:38 PM, Karl Young<kar...@uc...> wrote:
>
> I have 2 float arrays of the same dimension which I use to generate a
> 3rd array, again of the same dimension, containing integers from a small
> set (I obtain the 3rd array via clustering in the 2 dimensional space of
> points obtained as values from the same location in the initial 2
> arrays). I'd like to do a scatter plot using scatter, with x-axis values
> as values from the first array, y-values as values from the second array
> and color of the points corresponding to the integer in the 3rd array
> (so far so good; I can do that much). Then I'd like to plot an image
> using imshow of the 3rd array with colors corresponding to those in the
> scatter plot. I can generate the image with imshow ok but can't the
> colors to match those in the scatter plot. Here's a snippet (assume
> array1,array2, and array3 are 2D arrays):
>
> hot()
> scatter(array1.ravel(), array2.ravel(), c =
> numpy.array(array3.ravel(),float))
> imshow(array3)
> show()
>
> The main problem is that I can't figure out how to force the plot colors
> for imshow to correspond to those in scatter. Thanks for any thought or
> suggestions. Cheers,
w/o a complete, self contained code sample that we can run and play
with on our machines, it is harder to help. Have you tried forcing
the clim to be set to the interval you want?
http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.clim
JDH
From: John H. <jd...@gm...> - 2009年06月05日 12:48:24
On Thu, Jun 4, 2009 at 5:33 PM, Sandro Tosi <mat...@gm...> wrote:
> Hi,
>
> On Thu, Jun 4, 2009 at 23:26, citronade <ric...@ma...> wrote:
>>
>> I am trying to set the x and y axis range on a log-log plot. The ranges I
>> give are automatically adjusted to the nearest power of 10, but I would like
>> to have the minimum and maximum axis values not be powers of 10. Is there a
>> way to set the axis range so that it is not automatically rescaled?
You can turn autoscaling off entirely with
 ax.set_autoscale_on(False)
And then set the xlim/ylim as you like as Sandro suggested.
JDH
From: John H. <jd...@gm...> - 2009年06月05日 11:22:26
On Fri, Jun 5, 2009 at 4:56 AM, Paul Anton
Letnes<pau...@gm...> wrote:
> Hi Chaitanya (and everyone else),
>
>
> thanks for some nice advice! The font and legend frame tips worked
> quite well.
>
> I would appreciate it if it was possible to remove the legend frame by
> default, i.e. in the matplotlibrc file, if possible. In my opinion,
> this frame clutters the plot unnecessarily; I rarely see such frames
> in publications.
I frequently make the frame semi-transparent, though this won't work for EPS
 leg = ax.legend(...)
 lege.get_frame().set_alpha(0.5)
Some rc default for the legend frame (on/off, alpha) would be useful.
JDH
From: Markus F. <fel...@gm...> - 2009年06月05日 11:15:08
Hi All,
i try to get a colorbar to work with:
 if not hasattr(self, 'subplot3'):
 self.subplot3 = self.figure.add_subplot(111)
 self.subplot3.grid(True)
 x,y,z = self.computehistogramm(min,min+self.maxitems)
 X,Y = meshgrid(x,y)
 plot = self.subplot3.pcolor(Y,X,z)
 self.figure.colorbar(plot)
but the x and y axis are interchanged, like this:
X
|
|
|
|
|
o-------------Y
But i want this:
Y
|
|
|
|
|
o-------------X
So how can i change this ?
the x and y data also depends on Z, so when i change x<-->y then i have
change z too ?
Any hints for me ?
As i read in the examples and in the docu this shoul be right,
 self.subplot3.pcolor(x,y,z)
But then my x and y data are wrong assigned to z, so i wrote
 self.subplot3.pcolor(y,x,z)
How to change my code so x and y are right assigned to z and i get this:
Y
|
|
|
|
|
o-------------X
regards Markus
From: Christophe D. <chr...@vh...> - 2009年06月05日 10:35:52
That's great, Pierre. Merci.
Christophe
-----Original Message-----
From: Pierre Raybaut [mailto:co...@py...] 
Sent: 04 June 2009 18:36
To: mat...@li...
Subject: Re: [Matplotlib-users] matplotlib and qtdesigner
mat...@li... a écrit :
> Message: 3
> Date: Thu, 4 Jun 2009 08:01:06 -0500
> From: "Christophe Dupre" <chr...@vh...>
> Subject: [Matplotlib-users] matplotlib and qtdesigner
> To: <mat...@li...>
> Message-ID:
> 	<F7D...@vh...>
> Content-Type: text/plain; charset="us-ascii"
>
> Hello there,
>
> 
>
> This is my first post, so first of all, thanks to the
> creators/contributors of matplotlib. It's a very nice software.
>
> 
>
> I've been developping an application using PyQT and matplotlib for a
> while now, and instead of coding the GUI, I'd like to make use of QT
> designer. 
>
> Does anyone know how I can add a MPL FigureCanvasQTAgg to a Main Window
> form in QT designer? Any (simple) example would be great.
>
> 
>
> Thanks,
>
> 
>
> Christophe 
Hi,
Someone asked me the same question on Python(x,y) discussion group 
(http://pythonxy.googlegroups.com) a few days ago.
So I've included a QtDesigner plugin in Python(x,y) matplotlib package.
Here is a screenshot:
http://pythonxy.googlegroups.com/web/mplplugin.png
Here is the source code (it's quite simple actually):
http://groups.google.fr/group/pythonxy/web/QtDesigner_Plugins.zip
(simply extract this in your site-packages directory)
Cheers,
Pierre
------------------------------------------------------------------------------
OpenSolaris 2009.06 is a cutting edge operating system for enterprises 
looking to deploy the next generation of Solaris that includes the latest 
innovations from Sun and the OpenSource community. Download a copy and 
enjoy capabilities such as Networking, Storage and Virtualization. 
Go to: http://p.sf.net/sfu/opensolaris-get
_______________________________________________
Matplotlib-users mailing list
Mat...@li...
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
No virus found in this incoming message.
Checked by AVG - www.avg.com 
Version: 8.5.339 / Virus Database: 270.12.49/2149 - Release Date: 06/04/09 05:53:00
From: Christophe D. <chr...@vh...> - 2009年06月05日 10:35:18
When I started using PyQt and matplotlib, I look at these 2 examples:
http://eli.thegreenplace.net/2009/01/20/matplotlib-with-pyqt-guis/
http://matplotlib.sourceforge.net/examples/user_interfaces/embedding_in_qt4.html
Regards,
Christophe
-----Original Message-----
From: projetmbc [mailto:pro...@cl...] 
Sent: 04 June 2009 16:49
To: Christophe Dupre
Cc: mat...@li...
Subject: Re: [Matplotlib-users] matplotlib and qtdesigner 
Christophe Dupre a écrit :
>
> I've been developping an application using PyQT and matplotlib for a 
> while now, and instead of coding the GUI, I'd like to make use of QT 
> designer.
>
Hello,
I'm interested by your code or simple parts of it wich show intercation 
between PyQt and matplotilib.
Best regards.
Another Christophe.
No virus found in this incoming message.
Checked by AVG - www.avg.com 
Version: 8.5.339 / Virus Database: 270.12.49/2149 - Release Date: 06/04/09 05:53:00
From: Paul A. L. <pau...@gm...> - 2009年06月05日 09:56:29
Hi Chaitanya (and everyone else),
thanks for some nice advice! The font and legend frame tips worked 
quite well.
I would appreciate it if it was possible to remove the legend frame by 
default, i.e. in the matplotlibrc file, if possible. In my opinion, 
this frame clutters the plot unnecessarily; I rarely see such frames 
in publications.
Thanks!
Paul.
Begin forwarded message:
> From: Chaitanya Krishna <ic...@gm...>
> Date: 3. juni 2009 08.26.07 GMT+02:00
> To: Paul Anton Letnes <pau...@gm...>
> Cc: mat...@li...
> Subject: Re: [Matplotlib-users] making publication quality plots
>
> Hi Paul,
>
> Can you try
> font.size: 10
> legend.fontsize: small [or medium] in your rc file.
>
> Defining the fontsize and then defining the fontsize of the xtick
> labels, legend etc with respect to this font size seems to work better
> than defining everything by hand.
>
> Switching off the legend frame does seem to save some place. You can
> use pylab.legend('your legend').draw_frame(False)
>
> Cheers,
> Chaitanya
>
> On Wed, Jun 3, 2009 at 8:11 AM, Paul Anton Letnes
> <pau...@gm...> wrote:
>> On 30. mai. 2009, at 13.56, John Hunter wrote:
>>
>>> On Sat, May 30, 2009 at 3:50 AM, Paul Anton Letnes
>>> <pau...@gm...> wrote:
>>>> Hello again,
>>>>
>>>>
>>>> I can set the figure size and font size, that all works fine.
>>>> However,
>>>> the legend is prohibitively large: for a plot 3 inches wide (why
>>>> doesn't matplotlib use centimeters or similar?), the legend takes 
>>>> up
>>>> about one third of the plot. This does not look too good...
>>>
>>> Please post a complete example. As for inches vs cm, that is my 
>>> fault
>>> -- I can't remember if it was for matlab compatibility, or due to 
>>> my
>>> provincial ways this side of the pond.
>>>
>>> JDH
>>
>> Hi,
>>
>> This is my function which does the plotting. The "coeffarr" is a 2D
>> array (function uses 7 first columns) with first column being
>> frequencies, other columns being real/imag part of whatever I'm
>> plotting.
>> #################
>> import matplotlib
>> matplotlib.use('ps')
>> import pylab
>> def plot(coeffarr):
>> 'Do the actual plotting.'
>> nfreqs, ncoeffs = coeffarr.shape
>> legends = []
>> for i in range(1, 6, 2): # real part columns
>> pylab.plot(coeffarr[:,0], coeffarr[:,i], RE_STYLE)
>> legends.append('l = %i' % int((i + 1) / 2))
>> pylab.plot(coeffarr[:,0], coeffarr[:,i+1], IM_STYLE)
>> legends.append('l = %i' % int((i + 1) / 2))
>> pylab.legend(legends)
>> pylab.xlabel('Frequency [eV]')
>> pylab.ylabel('$A_{lm}R^{-l-1}$')
>> pylab.savefig(PLOTFILE)
>> ####################
>> My matplotlibrc file is essentially this:
>> ####################
>> backend : MacOSX # added by paulanto on 16. feb. 08
>> numerix : numpy # numpy, Numeric or numarray
>> lines.linewidth : 1.0 # line width in points
>> font.family : serif
>> font.size : 10.0
>> text.usetex : True
>> axes.linewidth : 1.0 # edge linewidth
>> legend.fontsize : 10.0
>> figure.figsize : 3.0, 2.3 # figure size in inches
>> ####################
>>
>> Is this complete enough? If you do the plot, you'll see that the plot
>> is about one column wide (7 cm-ish) and that the legend is relatively
>> large. I made similar size plots in Gnuplot before, at font size 10,
>> but the legend was somehow less dominant.
>>
>> Also, will it help getting rid of the rectangle?
>>
>>
>> cheers,
>> Paul.
>>
>>
>> ------------------------------------------------------------------------------
>> OpenSolaris 2009.06 is a cutting edge operating system for 
>> enterprises
>> looking to deploy the next generation of Solaris that includes the 
>> latest
>> innovations from Sun and the OpenSource community. Download a copy 
>> and
>> enjoy capabilities such as Networking, Storage and Virtualization.
>> Go to: http://p.sf.net/sfu/opensolaris-get
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
From: Brian B. <bb...@br...> - 2009年06月05日 02:23:45
On Jun 4, 2009, at 19:48 , Esmail wrote:
> Someone recently generously shared this code with me on the python
since I was the one to share this with you, I might be able to answer 
a couple questions. :)
> list. While I have used pylab/matplotlib a bit, I didn't know about
> ion() (line 12),
ion() sets interactive mode on, so that the plot will update and show 
before the script is done. I usually use the pylab mode of ipython, 
so I don't have to use this, but I put it in to work with the regular 
python interpreter.
> nor am I sure about what is happening on line 19 and
> 21, does plot return a list?
> 18	 if t == 0: # first time calling
> 19	 h = plot(x,y,'ro')
> 20	 else:
> 21	 h[0].set_data(x,y)
>
it returns a list of line-type objects. since you are plotting a lot 
of dots, but one (invisible) line, then there is only one element in 
this list. If you had passed a 2D array into plot, then it would 
plot several lines, with possibly different properties. You can set 
the properties directly by calling the various set_ methods on the 
line-type object. In this case, the first call (when t==0) I make a 
regular plot, and get the object. After that, I set the data on the 
object directly, and then draw (so that it draws immediately). This 
is much faster than doing another plot command.
There may be better ways to do this animation, but I do it this way 
most of the time.
> Why is it subscripted to? Hadn't seen
> draw() before either, though I know show() .. these sort of things I
> am curious to learn about before I see them in code for the first
> time.
>
actually, that's how I learned most of it...by seeing it in code at 
some point. :)
hope this helps,
			bb
-- 
Brian Blais
bb...@br...
http://web.bryant.edu/~bblais
From: John H. <jd...@gm...> - 2009年06月05日 02:16:51
On Thu, Jun 4, 2009 at 6:48 PM, Esmail <eb...@ho...> wrote:
> Hi,
>
> Beginning Python Visualization: Crafting Visual Transformation Scripts
> by Shai Vaingast
> http://www.amazon.com/Beginning-Python-Visualization-Transformation-Professionals/dp/1430218436/ref=sr_1_1?ie=UTF8&s=books&qid=1244158389&sr=8-1
>
>
> Has anyone seen/read this book? I am looking for a good
> hardcopy reference for matplotlib and associated tools.
>
> While the gallery on the matplotlib site is a good way to learn, I
> would like a reference guide that I could easily print out or
> a tutorial of sorts, or possibly this book.
Have you tried the official docs? While they are not complete, they do
cover a number of things you mention that you have not seen before
(ion, draw, tutorial, etc.)
 HTML: http://matplotlib.sourceforge.net/users/index.html
 PDF: http://matplotlib.sf.net/Matplotlib.pdf
The book you refer to was recently reviewed on slashdot, BTW
 http://books.slashdot.org/article.pl?sid=09/05/27/1327255&from=rss
I've browsed some chapters on Amazon, and it looks well done, but have
not read it myself.
JDH
1 message has been excluded from this view by a project administrator.

Showing 22 results of 22

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 によって変換されたページ (->オリジナル) /