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

Showing results of 295

1 2 3 .. 12 > >> (Page 1 of 12)
From: Jae-Joon L. <lee...@gm...> - 2009年02月28日 23:51:09
FormatStrFormatter (and other formatters) rely on Python's string
interpolation, and It does not seem to be possible to get rid of the
leading zero (http://docs.python.org/library/stdtypes.html).
I think what you can do is to replace "0." with "." after the
interpolation. Something like below works for me.
from matplotlib.ticker import ScalarFormatter
s = subplot(111)
class ScalarFormatterNoLeadingZero(ScalarFormatter):
 def pprint_val(self, x):
 s = ScalarFormatter.pprint_val(self, x)
 return s.replace("0.",".")
s.xaxis.set_major_formatter(ScalarFormatterNoLeadingZero())
HTH,
-JJ
On Sat, Feb 28, 2009 at 4:52 PM, per freem <per...@gm...> wrote:
> hi all,
>
> when i make any numeric scatter plot containing floats, the formatted tick
> labels always have leading zeros, e.g "0.5" as opposed to ".5" in the
> labels.
>
> for example:
>
> x = rand(10)
> scatter(x,x)
>
> is there any way to change this to remove the leading zeros? i have tried:
>
> s = subplot(111)
> majorFormatter = FormatStrFormatter('%0.1f')
> s.xaxis.set_major_formatter(majorFormatter)
> scatter(x,x)
>
> but it does not work. i also tried "%.f" but it does not work either. the
> matlab default is to plot without the leading zero and i am trying to
> recreate this.
>
> thank you.
>
> ------------------------------------------------------------------------------
> Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
> -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
> -Strategies to boost innovation and cut costs with open source participation
> -Receive a 600ドル discount off the registration fee with the source code: SFAD
> http://p.sf.net/sfu/XcvMzF8H
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
From: Jae-Joon L. <lee...@gm...> - 2009年02月28日 23:04:30
On Sat, Feb 28, 2009 at 5:31 PM, per freem <per...@gm...> wrote:
> thank you for your reply. when i try either of the first suggestions about
> changing the fonts, i get the error:
>
> AttributeError: 'FontProperties' object has no attribute 'get_slant'
>
> any idea what this means?
It seems that you're using v0.98.3 or before. See if following code works.
from matplotlib.font_manager import FontProperties
def my_hash(self):
 l = [self.get_family(),
 self.get_style(),
 self.get_variant(),
 self.get_weight(),
 self.get_stretch(),
 self.get_size()]
 return hash(repr(l))
FontProperties.__hash__ = my_hash
>
> also, i do not mind setting the position of each tickmark individually but i
> cannot find a way to do this -- could you please explain how this can be
> done?
>
http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.xticks
http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.yticks
-JJ
> thanks again.
>
>
> On Sat, Feb 28, 2009 at 5:19 PM, Jae-Joon Lee <lee...@gm...> wrote:
>>
>> > but it does not work. i tried similarly setting the font size (with
>> > set_size() or through rcParams) but it did not work either. how can i do
>> > this? i'd like to do this either on per axes basis, or for the entire
>> > figure.
>>
>> It seems that changing rcParams is not effective because of the way
>> how the font caching is done. Here is a little monkey patching to
>> change this behavior.
>>
>> from matplotlib.font_manager import FontProperties
>>
>> def my_hash(self):
>>  l = dict([(k, getattr(self, "get" + k)()) for k in self.__dict__])
>>  return hash(repr(l))
>>
>> FontProperties.__hash__ = my_hash
>>
>>
>> With this code, changing rcParams will affect (most of) the text in the
>> figure.
>>
>> As far as I know, you cannot have a default font properties on per
>> axes basis. You need to manually change the font properties of Text
>> artists in your interests.
>>
>> For example, to change the font properties of the xtick labels,
>>
>> fp = FontProperties(family="Lucida Sans Typewriter")
>> ax = gca()
>> for t in ax.get_xticklabels():
>>  t.set_fontproperties(fp)
>>
>>
>> >
>> > second, how can i make it so axes labels do not overlap? in many plots,
>> > including ones in the gallery, you see the labels at the origin of plots
>> > get
>> > too close to each other. (i.e. the 0.0 of x-axis and 0.0 of y-axis) -
>> > how
>> > can you prevent this from happening?
>> >
>>
>> I don't think there is a smart way to prevent it other than manually
>> changing the tick positions. Other may have better ideas.
>>
>> -JJ
>
>
From: per f. <per...@gm...> - 2009年02月28日 22:31:58
thank you for your reply. when i try either of the first suggestions about
changing the fonts, i get the error:
AttributeError: 'FontProperties' object has no attribute 'get_slant'
any idea what this means?
also, i do not mind setting the position of each tickmark individually but i
cannot find a way to do this -- could you please explain how this can be
done?
thanks again.
On Sat, Feb 28, 2009 at 5:19 PM, Jae-Joon Lee <lee...@gm...> wrote:
> > but it does not work. i tried similarly setting the font size (with
> > set_size() or through rcParams) but it did not work either. how can i do
> > this? i'd like to do this either on per axes basis, or for the entire
> > figure.
>
> It seems that changing rcParams is not effective because of the way
> how the font caching is done. Here is a little monkey patching to
> change this behavior.
>
> from matplotlib.font_manager import FontProperties
>
> def my_hash(self):
> l = dict([(k, getattr(self, "get" + k)()) for k in self.__dict__])
> return hash(repr(l))
>
> FontProperties.__hash__ = my_hash
>
>
> With this code, changing rcParams will affect (most of) the text in the
> figure.
>
> As far as I know, you cannot have a default font properties on per
> axes basis. You need to manually change the font properties of Text
> artists in your interests.
>
> For example, to change the font properties of the xtick labels,
>
> fp = FontProperties(family="Lucida Sans Typewriter")
> ax = gca()
> for t in ax.get_xticklabels():
> t.set_fontproperties(fp)
>
>
> >
> > second, how can i make it so axes labels do not overlap? in many plots,
> > including ones in the gallery, you see the labels at the origin of plots
> get
> > too close to each other. (i.e. the 0.0 of x-axis and 0.0 of y-axis) - how
> > can you prevent this from happening?
> >
>
> I don't think there is a smart way to prevent it other than manually
> changing the tick positions. Other may have better ideas.
>
> -JJ
>
From: Jae-Joon L. <lee...@gm...> - 2009年02月28日 22:19:21
> but it does not work. i tried similarly setting the font size (with
> set_size() or through rcParams) but it did not work either. how can i do
> this? i'd like to do this either on per axes basis, or for the entire
> figure.
It seems that changing rcParams is not effective because of the way
how the font caching is done. Here is a little monkey patching to
change this behavior.
from matplotlib.font_manager import FontProperties
def my_hash(self):
 l = dict([(k, getattr(self, "get" + k)()) for k in self.__dict__])
 return hash(repr(l))
FontProperties.__hash__ = my_hash
With this code, changing rcParams will affect (most of) the text in the figure.
As far as I know, you cannot have a default font properties on per
axes basis. You need to manually change the font properties of Text
artists in your interests.
For example, to change the font properties of the xtick labels,
fp = FontProperties(family="Lucida Sans Typewriter")
ax = gca()
for t in ax.get_xticklabels():
 t.set_fontproperties(fp)
>
> second, how can i make it so axes labels do not overlap? in many plots,
> including ones in the gallery, you see the labels at the origin of plots get
> too close to each other. (i.e. the 0.0 of x-axis and 0.0 of y-axis) - how
> can you prevent this from happening?
>
I don't think there is a smart way to prevent it other than manually
changing the tick positions. Other may have better ideas.
-JJ
From: per f. <per...@gm...> - 2009年02月28日 21:52:13
hi all,
when i make any numeric scatter plot containing floats, the formatted tick
labels always have leading zeros, e.g "0.5" as opposed to ".5" in the
labels.
for example:
x = rand(10)
scatter(x,x)
is there any way to change this to remove the leading zeros? i have tried:
s = subplot(111)
majorFormatter = FormatStrFormatter('%0.1f')
s.xaxis.set_major_formatter(majorFormatter)
scatter(x,x)
but it does not work. i also tried "%.f" but it does not work either. the
matlab default is to plot without the leading zero and i am trying to
recreate this.
thank you.
From: Eric F. <ef...@ha...> - 2009年02月28日 20:05:44
Jae-Joon Lee wrote:
> Hi Erick,
> 
> Is there any particular reason to introduce _xaxison and _yaxison,
> instead of using set_visible(False) on the xaxis and yaxis? Just
> wondering..
Good catch--I just didn't think of it. That is a much better solution. 
 I'll do it shortly.
Thank you.
Eric
> 
> -JJ
> 
> 
> 
> On Sat, Feb 28, 2009 at 1:52 PM, Eric Firing <ef...@ha...> wrote:
>> Christoffer Aberg wrote:
>>> Hi all,
>>>
>>> I have noticed a funny behaviour when using twinx to do two plots on the
>>> same axes: the xticklabels are printed twice, once for each axes. This
>>> shows up as slightly thicker labels than for a single axes. It is
>>> particularly visible for ps or pdf output, but can be seen also in an
>>> interactive session.
>>>
>>> I can also see this in the figure shown for the two_scales.py example
>>> (http://matplotlib.sourceforge.net/_images/two_scales.png), where the
>>> xticklabels are thicker than the yticklabels (though it is not so
>>> apparent due to different colours. I therefore assume it is not just my
>>> installation. (Adding
>>>
>>> for tl in ax2.get_xticklabels():
>>> tl.set_fontsize(16)
>>>
>>> just before the last plt.show() in two_scales.py makes it even more
>>> visible)
>>>
>>> Does anyone know of a reasonable work-around? Surely it is not the
>>> intended behaviour?
>> It is now fixed in svn.
>>
>> Eric
>>
>> ------------------------------------------------------------------------------
>> Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
>> -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
>> -Strategies to boost innovation and cut costs with open source participation
>> -Receive a 600ドル discount off the registration fee with the source code: SFAD
>> http://p.sf.net/sfu/XcvMzF8H
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
From: Eric F. <ef...@ha...> - 2009年02月28日 19:56:56
Sandro Tosi wrote:
> Hi!
> I have this configuration file:
> 
> $ cat matplotlibrc
> figure.figsize : 4, 3
> figure.dpi	 : 300
> savefig.dpi	 : 300
> font.size	 : 9.0
> 
> and using this code
> 
> import matplotlib.pyplot as plt
> plt.plot([1, 2, 3])
> plt.xlabel('This is the X axis')
> plt.ylabel('This is the Y axis')
> plt.savefig('7900_02_06.png')
> 
> I obtain the attached image that, as you can see, has xlabel tect cut.
> 
> What is the best way to avoid it? reducing the actual "plot" area
> (axes and line)? or reducing the font size?
> 
> Now that I look better at it, isn't it a bug after all? I see ylabel
> correctly rendered, and xlabel not (but it's late in the night, so I
> might be mistaken :) ) .
It is not really a bug; it is an inherent limitation in mpl's default 
automatic Axes positioning. Axes positions are given in normalized 
coordinates relative to the figure, so if you shrink the height of the 
figure (relative to the default, for which the default positioning 
parameters are designed), there is less physical space available for the 
x-axis ticks, ticklabels, and label--and things can get cut off. If you 
are adjusting the figsize and/or the font size, then chances are you 
need to adjust these normalized coordinate Axes position parameters as 
well. Trial and error is typically needed; it can be facilitated by 
using the subplot adjuster widget in an interactive window (second to 
last button on the toolbar) to decide what looks good. Then use the 
figure.subplot.* entries in matplotlibrc, or call 
plt.subplots_adjust(bottom=0.15) (for example), or call it as a method 
of the figure you have just created.
For doing the interactive adjustment, you will want to use a smaller 
figure dpi, something to match your screen. Everything will scale 
correctly when you save the figure at higher dpi.
Eric
> 
> Thanks in advance,
> 
> 
> ------------------------------------------------------------------------
> 
> 
> ------------------------------------------------------------------------
> 
> ------------------------------------------------------------------------------
> Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
> -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
> -Strategies to boost innovation and cut costs with open source participation
> -Receive a 600ドル discount off the registration fee with the source code: SFAD
> http://p.sf.net/sfu/XcvMzF8H
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Jae-Joon L. <lee...@gm...> - 2009年02月28日 19:30:50
Hi Erick,
Is there any particular reason to introduce _xaxison and _yaxison,
instead of using set_visible(False) on the xaxis and yaxis? Just
wondering..
-JJ
On Sat, Feb 28, 2009 at 1:52 PM, Eric Firing <ef...@ha...> wrote:
> Christoffer Aberg wrote:
>> Hi all,
>>
>> I have noticed a funny behaviour when using twinx to do two plots on the
>> same axes: the xticklabels are printed twice, once for each axes. This
>> shows up as slightly thicker labels than for a single axes. It is
>> particularly visible for ps or pdf output, but can be seen also in an
>> interactive session.
>>
>> I can also see this in the figure shown for the two_scales.py example
>> (http://matplotlib.sourceforge.net/_images/two_scales.png), where the
>> xticklabels are thicker than the yticklabels (though it is not so
>> apparent due to different colours. I therefore assume it is not just my
>> installation. (Adding
>>
>> for tl in ax2.get_xticklabels():
>>   tl.set_fontsize(16)
>>
>> just before the last plt.show() in two_scales.py makes it even more
>> visible)
>>
>> Does anyone know of a reasonable work-around? Surely it is not the
>> intended behaviour?
>
> It is now fixed in svn.
>
> Eric
>
> ------------------------------------------------------------------------------
> Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
> -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
> -Strategies to boost innovation and cut costs with open source participation
> -Receive a 600ドル discount off the registration fee with the source code: SFAD
> http://p.sf.net/sfu/XcvMzF8H
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: per f. <per...@gm...> - 2009年02月28日 19:23:32
hi all,
two quick questions about plotting: i am trying to very simply reset the
font family to be 'helvetica' for my figure, in particular for the
ticklabels. i have tried using the following:
def axes_square(plot_handle):
 plot_handle.axes.set_aspect(1/plot_handle.axes.get_data_ratio())
rcParams['font.family'] = 'Helvetica'
p = matplotlib.font_manager.FontProperties()
p.set_family('Helvetica')
x = rand(20)
ax = plot(x, x, 'bo', markeredgecolor='blue', mfc='none')
axes_square(p)
but it does not work. i tried similarly setting the font size (with
set_size() or through rcParams) but it did not work either. how can i do
this? i'd like to do this either on per axes basis, or for the entire
figure.
second, how can i make it so axes labels do not overlap? in many plots,
including ones in the gallery, you see the labels at the origin of plots get
too close to each other. (i.e. the 0.0 of x-axis and 0.0 of y-axis) - how
can you prevent this from happening?
thank you!
From: Eric F. <ef...@ha...> - 2009年02月28日 18:52:53
Christoffer Aberg wrote:
> Hi all,
> 
> I have noticed a funny behaviour when using twinx to do two plots on the
> same axes: the xticklabels are printed twice, once for each axes. This
> shows up as slightly thicker labels than for a single axes. It is
> particularly visible for ps or pdf output, but can be seen also in an
> interactive session.
> 
> I can also see this in the figure shown for the two_scales.py example
> (http://matplotlib.sourceforge.net/_images/two_scales.png), where the
> xticklabels are thicker than the yticklabels (though it is not so
> apparent due to different colours. I therefore assume it is not just my
> installation. (Adding
> 
> for tl in ax2.get_xticklabels():
> tl.set_fontsize(16)
> 
> just before the last plt.show() in two_scales.py makes it even more
> visible)
> 
> Does anyone know of a reasonable work-around? Surely it is not the
> intended behaviour?
It is now fixed in svn.
Eric
From: Jonathan T. <jon...@ut...> - 2009年02月28日 17:22:58
Hi,
I have a simple script that plots x,y vals in an animation called anim.py
data = read('data.dat')
for i in range(10):
 plot(data[:,0], data[:,1])
I am using ipython -pylab but when I do run anim.py it doesn't show
anything until I say show(). On the other hand, if I do one of these
plotting commands from the ipython terminal it shows up right away.
It seems that everything works fine once one thing has been plotted
from the ipython command line. Is there any way to fix this so that
it plots right away as expected?
Thanks,
Jon.
From: George N. <gn...@go...> - 2009年02月28日 11:05:40
David,
This seems to work for me:
(here ax2 is the second axis)
The only work around I can see is to add
for tl in ax2.get_xticklabels():
 tl.set_visible(False)
To prevent the ticklines being drawn twice I guess we should also do
for tline in ax2.get_xticklines():
 tline.set_visible(False)
HTH, George.
2009年2月27日 David Huard <dav...@gm...>:
> I'd also be interested in a workaround. I tried to remove the tick labels
> from the second axe, but it also removed the labels from the first axe.
>
> Thanks,
>
> David
>
> On Sun, Feb 8, 2009 at 9:14 AM, Christoffer Aberg
> <Chr...@fk...> wrote:
>>
>> Hi all,
>>
>> I have noticed a funny behaviour when using twinx to do two plots on the
>> same axes: the xticklabels are printed twice, once for each axes. This
>> shows up as slightly thicker labels than for a single axes. It is
>> particularly visible for ps or pdf output, but can be seen also in an
>> interactive session.
>>
>> I can also see this in the figure shown for the two_scales.py example
>> (http://matplotlib.sourceforge.net/_images/two_scales.png), where the
>> xticklabels are thicker than the yticklabels (though it is not so
>> apparent due to different colours. I therefore assume it is not just my
>> installation. (Adding
>>
>> for tl in ax2.get_xticklabels():
>>  tl.set_fontsize(16)
>>
>> just before the last plt.show() in two_scales.py makes it even more
>> visible)
>>
>> Does anyone know of a reasonable work-around? Surely it is not the
>> intended behaviour?
>>
>> Thanks for any help,
>> Christoffer Åberg
>>
>>
>>
>> ------------------------------------------------------------------------------
>> Create and Deploy Rich Internet Apps outside the browser with
>> Adobe(R)AIR(TM)
>> software. With Adobe AIR, Ajax developers can use existing skills and code
>> to
>> build responsive, highly engaging applications that combine the power of
>> local
>> resources and data with the reach of the web. Download the Adobe AIR SDK
>> and
>> Ajax docs to start building applications
>> today-http://p.sf.net/sfu/adobe-com
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
> ------------------------------------------------------------------------------
> Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
> -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
> -Strategies to boost innovation and cut costs with open source participation
> -Receive a 600ドル discount off the registration fee with the source code: SFAD
> http://p.sf.net/sfu/XcvMzF8H
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
From: Naoli <na...@tu...> - 2009年02月28日 09:10:26
Hi guys,
I was wondering if it's possible to rotate a legend ?
Thanks for your help.
Naoli
From: Sandro T. <mo...@de...> - 2009年02月28日 01:02:48
Attachments: 7900_02_06.png
Hi!
I have this configuration file:
$ cat matplotlibrc
figure.figsize : 4, 3
figure.dpi	 : 300
savefig.dpi	 : 300
font.size	 : 9.0
and using this code
import matplotlib.pyplot as plt
plt.plot([1, 2, 3])
plt.xlabel('This is the X axis')
plt.ylabel('This is the Y axis')
plt.savefig('7900_02_06.png')
I obtain the attached image that, as you can see, has xlabel tect cut.
What is the best way to avoid it? reducing the actual "plot" area
(axes and line)? or reducing the font size?
Now that I look better at it, isn't it a bug after all? I see ylabel
correctly rendered, and xlabel not (but it's late in the night, so I
might be mistaken :) ) .
Thanks in advance,
-- 
Sandro Tosi (aka morph, morpheus, matrixhasu)
My website: http://matrixhasu.altervista.org/
Me at Debian: http://wiki.debian.org/SandroTosi
From: lionel k. <lio...@gm...> - 2009年02月27日 22:29:49
Hello all, I'd like to create a "matplotlib.pyplot.figure(...)" object
and specify the size while I'm at it. I see this argument list from
the matplotlib's documentation:
pyplot.figure(num=None, figsize=(8, 6), dpi=80, facecolor='w', edgecolor='k')
The on-screen size is being computed using inches (for height and
width) and dpi. But I don't know what the dpi is in advance. What can
I do? In case it's relevant, I'm using Python 2.5 and the latest
download of matplotlib.
Thanks in advance.
-L
From: David H. <dav...@gm...> - 2009年02月27日 22:05:26
I'd also be interested in a workaround. I tried to remove the tick labels
from the second axe, but it also removed the labels from the first axe.
Thanks,
David
On Sun, Feb 8, 2009 at 9:14 AM, Christoffer Aberg <
Chr...@fk...> wrote:
> Hi all,
>
> I have noticed a funny behaviour when using twinx to do two plots on the
> same axes: the xticklabels are printed twice, once for each axes. This
> shows up as slightly thicker labels than for a single axes. It is
> particularly visible for ps or pdf output, but can be seen also in an
> interactive session.
>
> I can also see this in the figure shown for the two_scales.py example
> (http://matplotlib.sourceforge.net/_images/two_scales.png), where the
> xticklabels are thicker than the yticklabels (though it is not so
> apparent due to different colours. I therefore assume it is not just my
> installation. (Adding
>
> for tl in ax2.get_xticklabels():
> tl.set_fontsize(16)
>
> just before the last plt.show() in two_scales.py makes it even more
> visible)
>
> Does anyone know of a reasonable work-around? Surely it is not the
> intended behaviour?
>
> Thanks for any help,
> Christoffer Åberg
>
>
>
> ------------------------------------------------------------------------------
> Create and Deploy Rich Internet Apps outside the browser with
> Adobe(R)AIR(TM)
> software. With Adobe AIR, Ajax developers can use existing skills and code
> to
> build responsive, highly engaging applications that combine the power of
> local
> resources and data with the reach of the web. Download the Adobe AIR SDK
> and
> Ajax docs to start building applications today-
> http://p.sf.net/sfu/adobe-com
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: Eric F. <ef...@ha...> - 2009年02月27日 21:25:31
Hansen, Dr. Jim wrote:
> Hello All
> 
> I'm making the transition from Matlab to Python/Pylab/matplotlib, etc. 
> 
> In Matlab contour plots I can specify the rotation angle of contour labels (e.g. rotation=0). I'm unable to figure out the equivalent in matplotlib's clabel. The inline documentation doesn't mention the option, but I'm confident there's a workaround.
with ipython -pylab:
CS = contour(rand(20,30))
tl = CS.clabel()
setp(tl, rotation=0)
Eric
From: Hansen, D. J. <jim...@nr...> - 2009年02月27日 21:14:17
Hello All
I'm making the transition from Matlab to Python/Pylab/matplotlib, etc. 
In Matlab contour plots I can specify the rotation angle of contour labels (e.g. rotation=0). I'm unable to figure out the equivalent in matplotlib's clabel. The inline documentation doesn't mention the option, but I'm confident there's a workaround.
Best,
Jim
From: Jae-Joon L. <lee...@gm...> - 2009年02月27日 20:31:46
I recommend you to use the Wedge class in matplotlib.patches.
from matplotlib.patches import Wedge
# draw a wedge in the axes coordinate. (0.5, 0.5) in axes coordinate
corresponds to (0,0) in polar coordinate.
trans = ax.transAxes
center, R = (0.5, 0.5), 0.5
twopi=360.
pie1 = Wedge(center, R, 0, r1*twopi, fc="g")
pie2 = Wedge(center, R, r1*twopi, r2*twopi, fc="y")
pie3 = Wedge(center, R, r2*twopi, twopi, fc="r")
for mypie in [pie1, pie2, pie3]:
 mypie.set_transform(trans)
 mypie.set_alpha(0.25)
 mypie.set_ec("none")
 ax.add_patch(mypie)
-JJ
On Thu, Feb 26, 2009 at 5:00 PM, bubye <joe...@gm...> wrote:
>
> I made a little more progress, but i'm not sure i'm doing this the right way.
> Suggestions?
>
> from pylab import *
> import numpy as np
>
> #generate random temperature data
> snp=[]
> for i in range(0,65):
>  snp.append(np.random.randint(35,122))
>
> #hide the labels. I don't want them.
> rc('xtick', labelsize=0)
> rc('ytick', labelsize=0)
>
> fig=figure(figsize=(8,8),facecolor='0.0')
>
> ax = fig.add_subplot(111,polar=True,frameon=False)
> tempTuple=array(snp)
> r = tempTuple/10
> theta = ((tempTuple*2.9508)*pi)/180
> area = r**2*(tempTuple/5.4)
> colors = theta
>
> #this is the fancy green,yellow,red background
> #it's actually a scatter plot that sits behind (zorder)
> #of the rest of the scatter plots.
>
> #radius
> r1 = 0.7   # 20%
> r2 = r1 + 0.2 # 40%
>
> # define some sizes of the scatter marker
> sizes = [55000]
> x = [0] + np.cos(np.linspace(0, 2*math.pi*r1, 100)).tolist()
> y = [0] + np.sin(np.linspace(0, 2*math.pi*r1, 100)).tolist()
> xy1 = zip(x,y)
>
> x = [0] + np.cos(np.linspace(2*math.pi*r1, 2*math.pi*r2, 100)).tolist()
> y = [0] + np.sin(np.linspace(2*math.pi*r1, 2*math.pi*r2, 100)).tolist()
> xy2 = zip(x,y)
>
> x = [0] + np.cos(np.linspace(2*math.pi*r2, 2*math.pi, 100)).tolist()
> y = [0] + np.sin(np.linspace(2*math.pi*r2, 2*math.pi, 100)).tolist()
> xy3 = zip(x,y)
>
> ax.scatter([0,0,0], [0,0,0], marker=(xy1,0), s=sizes,
> facecolor='green',alpha=.25,zorder=1)
> ax.scatter([0,0,0], [0,0,0], marker=(xy2,0), s=sizes, facecolor='yellow'
> ,alpha=.25,zorder=1)
> ax.scatter([0,0,0], [0,0,0], marker=(xy3,0), s=sizes,
> facecolor='red',alpha=.25,zorder=1)
> ax.scatter(theta, r, c=colors, s=area,zorder=2)
> ax.grid(False)
>
> show()
>
> --
> View this message in context: http://www.nabble.com/polar-graph-tp22230232p22234721.html
> Sent from the matplotlib - users mailing list archive at Nabble.com.
>
>
> ------------------------------------------------------------------------------
> Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
> -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
> -Strategies to boost innovation and cut costs with open source participation
> -Receive a 600ドル discount off the registration fee with the source code: SFAD
> http://p.sf.net/sfu/XcvMzF8H
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: Kasper P. <kas...@ae...> - 2009年02月27日 18:09:07
Hi all,
(A bit off-topic, hope this is ok, please redirect me if this is more
appropriate on a different list).
I am interested in using the mathtext rendering functionality separate
from the plotting part of matplotlib. To be precise, I would like to
use mathtext as a replacement mathematics renderer in the notebook
front-end of my symbolic computer algebra system 'cadabra',
 http://www.aei.mpg.de/~peekas/cadabra/
(right now I am using latex/dvipng to render mathematical expressions,
which is slow and not very flexible). 
I would prefer to use mathtext to render onto a cairo drawing surface
(since I already have plans to use cairo to improve the
front-end). Are there any examples showing how to do this, or could
someone perhaps post a small code snippet to get me started? Thanks!
Cheers,
Kasper
From: Christopher B. <Chr...@no...> - 2009年02月27日 17:30:34
Michael Droettboom wrote:
> Which backend are you using? I don't see any explicit calls to chdir in 
> matplotlib that would make this happen. It would certainly be 
> unintentional if it is.
I don't know about any other back-ends, but the wx FileDialog has an 
option to change the working dir when the user selects a file I also 
don't know if this flag is set in the MPL code, but it shouldn't be.
> Søren Nielsen wrote:
>> my program can 
>> no longer locate the icons (used in my GUI) that I am using in my 
>> .\ressources directory. So saving the plot changed the working 
>> directory of my program?
>> How do I change it back? Isn't this an error in matplotlib?
I'd say yes, but it's also an error in the design of your code -- as 
you've discovered, the working dir is a tenuous concept -- you should 
set that resources dir in your code start-up and keep it around for when 
you need it.
wxPython has wx.StandardPaths which can be helpful for finding your aps 
data, etc -- I'm sure the other toolkits have something, too.
-Chris
-- 
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年02月27日 16:48:28
Matthias Michler wrote:
> On Thursday 26 February 2009 20:52:17 Christopher Brown wrote:
>> Hi,
>>
>> If I have a figure:
>>
>> h = pp.figure(num=14)
>>
>> What is the best way to check to see if Figure 14 exists? I'm writing a
>> function that adds plots to a figure window. I want the function to
>> check if the figure exists, and if so, turn off autoscaling (using
>> Eric's suggested axes.set_autoscale_on(False)) in case the user has zoomed.
> 
> Hi Christopher,
> 
> I don't know if my suggestion is the best way, but at least it may be 
> useful ...
I think your suggestion is the only way at present, but it suggests that 
we should provide this capability as part of the API; we don't want to 
force people to access the private _pylab_helpers module directly.
Eric
> 
> regards Matthias
> 
> example code:
> 
> import matplotlib
> import matplotlib.pyplot as plt
> 
> 
> for i in range(5)+[14]:
> plt.figure(i) # generating some figures
> 
> # get the figure numbers of all existing figures
> fig_numbers = [x.num
> for x in matplotlib._pylab_helpers.Gcf.get_all_fig_managers()]
> 
> if 14 in fig_numbers:
> print "figure 14 exists" 
> 
> if plt.figure(14).number in fig_numbers:
> print "figure 14 exists" 
> 
> 
> 
> ------------------------------------------------------------------------------
> Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
> -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
> -Strategies to boost innovation and cut costs with open source participation
> -Receive a 600ドル discount off the registration fee with the source code: SFAD
> http://p.sf.net/sfu/XcvMzF8H
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Michael D. <md...@st...> - 2009年02月27日 13:44:02
Which backend are you using? I don't see any explicit calls to chdir in 
matplotlib that would make this happen. It would certainly be 
unintentional if it is.
Mike
Søren Nielsen wrote:
> Hi,
>
> When I save a plot using the toolbar save function, and I save to a 
> different directory than the one where my program is, my program can 
> no longer locate the icons (used in my GUI) that I am using in my 
> .\ressources directory. So saving the plot changed the working 
> directory of my program?
>
> How do I change it back? Isn't this an error in matplotlib?
>
> Thanks
> Soren
> ------------------------------------------------------------------------
>
> ------------------------------------------------------------------------------
> Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
> -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
> -Strategies to boost innovation and cut costs with open source participation
> -Receive a 600ドル discount off the registration fee with the source code: SFAD
> http://p.sf.net/sfu/XcvMzF8H
> ------------------------------------------------------------------------
>
> _______________________________________________
> 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年02月27日 13:38:18
Gökhan SEVER wrote:
> Hello,
>
> My first message in the list. I would like to mention a few things 
> about the matplotlib PDF document.
>
> Firstly, the download link for the pdf document (@ 
> http://matplotlib.sourceforge.net/contents.html) is for release 
> 0.98.5.1, compiled on December 17, instead of 0.98.5.2, on Dec-18.
Thanks. I don't recall the current policy under which documentation is 
being pushed to the site, so I'll leave that for others to address.
>
> Next, is there a way to get functions separately listed under each 
> bookmark listing in the pdf file? For example if I go IV Matplotlib 
> API section from the bookmarks menu and click the matplotlib.pyplot 
> seb-menu I would like to see the function names listed. In addition to 
> module indexing (where keywords highlighted back to original names) 
> this would be a nice feature to add the pdf documentation.
This sounds like something to be added/fixed within the documentation 
system we use -- Sphinx. If you want to tackle this yourself, I would 
head over there and read some documentation and mailing lists and see if 
it's been done -- otherwise pursue what it might take to make it work. 
We would definitely welcome this change.
Mike
-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA
From: Michael D. <md...@st...> - 2009年02月27日 13:36:01
There are obviously geometric solutions to this that wouldn't require 
interpolation -- though the interpolation is a good easy workaround. I 
think it would be great to file a bug for this in the tracker so it 
doesn't get forgotten.
Mike
Ryan Wagner wrote:
>
> Is this a bug in fill_between, or is there a known workaround?
>
> In the attached picture, I’m calling fill_between as follows, and I 
> can’t fill the entire area between the line (50+thresh) and the 
> signal, s. I realize that the areas that aren’t filled are boundary 
> conditions, but there should be some sort of interpolation I can do to 
> fix this I would think...
>
> ax.fill_between(stockData.inds, s[stockData.rinds], 50+thresh, 
> where=s[stockData.rinds]>50+thresh, color=color, alpha=0.3 )
>
> So for example: stockData.inds = range(6), s[stockData.rinds] = 
> [20,30,70,80,40,20] and thresh = 0. I need the areas filled with color 
> where stockData.rinds is greater than 50. It does fully fill in the 
> xrange(2,3), but the border conditions xrange(1,2) and xrange(3,4) are 
> not fully filled under the line.
>
> I had the same problem with fill_over and was hoping it would be 
> resolved with the move to fill_between. Any ideas?
>
> -Ryan
>
>
> ------------------------------------------------------------------------
>
> ------------------------------------------------------------------------
>
> ------------------------------------------------------------------------------
> Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
> -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
> -Strategies to boost innovation and cut costs with open source participation
> -Receive a 600ドル discount off the registration fee with the source code: SFAD
> http://p.sf.net/sfu/XcvMzF8H
> ------------------------------------------------------------------------
>
> _______________________________________________
> 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
6 messages has been excluded from this view by a project administrator.

Showing results of 295

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