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

Showing 19 results of 19

From: Christopher B. <c-...@as...> - 2008年05月22日 22:26:25
Hi Users,
What is the best way to add a subscript to a tick label using the 
default font?
-- 
Chris
From: Michael D. <md...@st...> - 2008年05月22日 17:39:14
You didn't mention the version of matplotlib you are using. There are 
some known bugs using NaNs on 0.90.x and 0.91.x that have been fixed on 
the trunk. Unfortunately, it will be difficult to backport these fixes.
Have you tried using masked arrays instead of arrays with NaNs?
Also, can you provide a standalone example that reproduces this error 
(including specific data?) so that we can further investigate?
Cheers,
Mike
Fabrice Silva wrote:
> Hello,
>
> I want to plot data containing nan values, but it seems that matplotlib
> forget some non-nan values near nan values.
> In the attached image, I plotted in blue the array for increasing of
> x-data, and in red for decreasing x-data : 
>
> import numpy as NX
>
> In [1]: from pylab import figure, plot, show
> In [2]: figure(2)
> Out[2]: <matplotlib.figure.Figure instance at 0x8445c8c>
> 
> In [3]: type(Freq)
> Out[3]: <type 'numpy.ndarray'>
> 
> In [4]: NX.any(NX.isnan(Freq))
> Out[4]: True
> 
> In [5]: type(Grillefr)
> Out[5]: <type 'numpy.ndarray'>
> 
> In [6]: NX.any(NX.isnan(Grillefr))
> Out[6]: False
> 
> In [7]: plot(Grillefr, Freq, 'b', lw=2.)
> Out[7]: [<matplotlib.lines.Line2D instance at 0x9245e8c>]
> 
> In [8]: plot(Grillefr[::-1], Freq[::-1], 'r', lw=0.5)
> Out[8]: [<matplotlib.lines.Line2D instance at 0x9245fec>]
> 
> In [9]: show()
> 
> with Grillefr containing values from 100 to 2000.
> In the matplotlibrc, I have : 
> maskedarray : True
>
> Can anybody explain me why some points are not drawn by matplotlib ?
> 
>
> ------------------------------------------------------------------------
>
> ------------------------------------------------------------------------
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> ------------------------------------------------------------------------
>
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
From: John H. <jd...@gm...> - 2008年05月22日 16:39:59
On Wed, May 21, 2008 at 10:57 AM, PaterMaximus
<Pat...@go...> wrote:
> I want to make one scatter plot and use the same scales on another. I think
> I seen getting the Axes from the first scatter plot using v=axis() and then
> setting them on second with axis(v) but I can not get to work. Any help
> appreciated
Try using shared scales:
ax1 = subplot(211)
ax2 = subplot(212, sharex=ax1, sharey=ax1)
JDH
From: John H. <jd...@gm...> - 2008年05月22日 16:39:11
On Thu, May 22, 2008 at 9:45 AM, Jouni K. Seppänen <jk...@ik...> wrote:
> I think this behavior of legend is suboptimal, but there is a logic to
> it: by default you label objects in the order you draw them, and the
> histogram plot happens to consist of several similarly-colored objects.
The best solution would be to rewrite the hist to use a collection.
This would make legend behave properly, would be a lot faster, but
would break a fair amount of legend code. Probably a good thing to do
for 0.98
JDH
From: Fabrice S. <si...@lm...> - 2008年05月22日 16:17:45
Correction :
> In the matplotlibrc, I have : 
> maskedarray : False
-- 
Fabrice Silva <si...@lm...>
LMA UPR CNRS 7051 - équipe S2M
From: Alan G I. <ai...@am...> - 2008年05月22日 16:16:24
On 2008年5月22日, Friedrich Hagedorn apparently wrote:
> I hope I can change my habit to type 'g' instead of 'r'. 
Or use an email client that allows you to register
your email lists to address this problem.
(Such as Mahogany mail.)
Cheers,
Alan Isaac
From: Fabrice S. <si...@lm...> - 2008年05月22日 16:00:06
Attachments: MA.matplotlib.png
Hello,
I want to plot data containing nan values, but it seems that matplotlib
forget some non-nan values near nan values.
In the attached image, I plotted in blue the array for increasing of
x-data, and in red for decreasing x-data : 
import numpy as NX
 In [1]: from pylab import figure, plot, show
 In [2]: figure(2)
 Out[2]: <matplotlib.figure.Figure instance at 0x8445c8c>
 
 In [3]: type(Freq)
 Out[3]: <type 'numpy.ndarray'>
 
 In [4]: NX.any(NX.isnan(Freq))
 Out[4]: True
 
 In [5]: type(Grillefr)
 Out[5]: <type 'numpy.ndarray'>
 
 In [6]: NX.any(NX.isnan(Grillefr))
 Out[6]: False
 
 In [7]: plot(Grillefr, Freq, 'b', lw=2.)
 Out[7]: [<matplotlib.lines.Line2D instance at 0x9245e8c>]
 
 In [8]: plot(Grillefr[::-1], Freq[::-1], 'r', lw=0.5)
 Out[8]: [<matplotlib.lines.Line2D instance at 0x9245fec>]
 
 In [9]: show()
 
with Grillefr containing values from 100 to 2000.
In the matplotlibrc, I have : 
maskedarray : True
Can anybody explain me why some points are not drawn by matplotlib ?
-- 
Fabrice Silva <si...@lm...>
LMA UPR CNRS 7051 - équipe S2M
From: Chiara C. <chi...@ho...> - 2008年05月22日 15:39:23
> p.setp(ax1.get_yticklabels(), color='r')
This worked!
Thanks a lot!
Chiara
> To: mat...@li...
> From: jk...@ik...
> Date: 2008年5月22日 17:52:09 +0300
> Subject: Re: [Matplotlib-users] changing ticklabels color
> 
> Chiara Caronna <chi...@ho...> writes:
> 
> > ax1=p.subplot(212)
> > ax1.set_xlabel('t [sec]')
> > ax1.set_ylabel('g^2(q,t)')
> > ax1.set_yticklabels(color='r')
> 
> You could do
> 
> for label in ax1.get_yticklabels(): label.set_color('r')
> 
> or use the setp shortcut:
> 
> p.setp(ax1.get_yticklabels(), color='r')
> 
> -- 
> Jouni K. Seppänen
> http://www.iki.fi/jks
> 
> 
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
_________________________________________________________________
Invite your mail contacts to join your friends list with Windows Live Spaces. It's easy!
http://spaces.live.com/spacesapi.aspx?wx_action=create&wx_url=/friends.aspx&mkt=en-us 
From: Friedrich H. <fri...@gm...> - 2008年05月22日 15:12:44
On Thu, May 22, 2008 at 05:59:23PM +0300, Jouni K. Seppänen wrote:
> Friedrich Hagedorn <fri...@gm...> writes:
> 
> > could you set the right reply-adress in the mails from the 
> > matplotlib mailinglist?
> 
> This is something of a controversial issue. One side is presented at
> 
> http://www.unicom.com/pw/reply-to-harmful.html
> 
> and I'm sure the other one has a web page somewhere, too. On lists that
> do not munge the reply-to address, such as the matplotlib lists, you
> have two options: you can reply to the sender only ('r' in mutt) or
> reply to everyone ('g'). On lists that do munge the address, both
> commands reply to the complete list.
Ok, I test it with 'g' by this reply, and it works. I hope I can change
my habit to type 'g' instead of 'r'.
On Thu, May 22, 2008 at 04:59:39PM +0200, Johann Rohwer wrote:
> This has been discussed before. See:
>
> http://sourceforge.net/mailarchive/message.php?msg_id=4756A726.1080104%40gmx.net
Ah, I see the discussion. I am for 'r' :-)
By, Friedrich
From: Jouni K. S. <jk...@ik...> - 2008年05月22日 15:08:03
Chiara Caronna <chi...@ho...> writes:
> ax1=p.subplot(212)
> ax1.set_xlabel('t [sec]')
> ax1.set_ylabel('g^2(q,t)')
> ax1.set_yticklabels(color='r')
You could do
for label in ax1.get_yticklabels(): label.set_color('r')
or use the setp shortcut:
p.setp(ax1.get_yticklabels(), color='r')
-- 
Jouni K. Seppänen
http://www.iki.fi/jks
From: Johann R. <jr...@su...> - 2008年05月22日 15:07:44
This has been discussed before. See:
http://sourceforge.net/mailarchive/message.php?msg_id=4756A726.1080104%40gmx.net
Johann
Friedrich Hagedorn wrote:
> Hello List-Admin,
> 
> could you set the right reply-adress in the mails from the 
> matplotlib mailinglist?
> 
> Everytime when I what to reply to a message I have to set the right
> email-adress to
> 
> mat...@li...
> 
> otherwise the email would sent only as a privat mail.
> 
> I use mutt and on all other mailinglist I have no problem. So I think
> this is a matplotlib-ml problem.
From: Friedrich H. <fri...@gm...> - 2008年05月22日 15:04:13
On Thu, May 22, 2008 at 02:30:24PM +0000, Chiara Caronna wrote:
> Hello,
> I would like to change the color of the yticklabels. I tried to use this
> command:
> 
> ax1=p.subplot(212)
[...]
> ax1.set_yticklabels(color='r')
* Solution 1:
In [1]: ax1=subplot(111)
In [2]: setp(ax1.get_yaxis().get_major_ticklabels(), color='r')
* Solution 2:
In [1]: ax1=subplot(111)
In [2]: for label in ax1.get_yaxis().get_majorticklabels():
 ...: label.set_color('r')
 ...: 
 ...: 
In [3]: draw()
May be there is a shorter solution but I dont know of it :-)
By, Friedrich
From: Jouni K. S. <jk...@ik...> - 2008年05月22日 14:59:38
Friedrich Hagedorn <fri...@gm...> writes:
> could you set the right reply-adress in the mails from the 
> matplotlib mailinglist?
This is something of a controversial issue. One side is presented at
http://www.unicom.com/pw/reply-to-harmful.html
and I'm sure the other one has a web page somewhere, too. On lists that
do not munge the reply-to address, such as the matplotlib lists, you
have two options: you can reply to the sender only ('r' in mutt) or
reply to everyone ('g'). On lists that do munge the address, both
commands reply to the complete list.
-- 
Jouni K. Seppänen
http://www.iki.fi/jks
From: Jouni K. S. <jk...@ik...> - 2008年05月22日 14:46:16
David Simpson <dav...@ch...> writes:
> This is probably my lack of knowledge of python, but how do I set up
> legend labels for some bar-plots that have been produced inside a 
> function. For example, the following will nicely plot my bar-plots, but 
> then legend doesn't know about the colours used, so here just uses black 
> for both labels.
Legends for multiple histograms don't behave the way people expect,
because the colors are taken bar by bar, first from one histogram, then
from the second histogram, etc. You need to take just one bar from each
histogram and pass them as the first argument to legend:
------------------------------------------------------------------------
from pylab import *
x=arange(0,5)
y=array([ 1.2, 3.4, 5.4, 2.3, 1.0])
z=array([ 2.2, 0.7, 0.4, 1.3, 1.2])
def plotb(x,y,col):
 p=bar(x,y,color=col)
 return p[0]
p1 = plotb(x,y,'k')
p2 = plotb(x+0.4,z,'y')
legend((p1, p2), ('YYY','ZZZ'))
show()
------------------------------------------------------------------------
I think this behavior of legend is suboptimal, but there is a logic to
it: by default you label objects in the order you draw them, and the
histogram plot happens to consist of several similarly-colored objects.
-- 
Jouni K. Seppänen
http://www.iki.fi/jks
From: Friedrich H. <fri...@gm...> - 2008年05月22日 14:45:34
Hello List-Admin,
could you set the right reply-adress in the mails from the 
matplotlib mailinglist?
Everytime when I what to reply to a message I have to set the right
email-adress to
 mat...@li...
otherwise the email would sent only as a privat mail.
I use mutt and on all other mailinglist I have no problem. So I think
this is a matplotlib-ml problem.
Thanks, Friedrich
From: Friedrich H. <fri...@gm...> - 2008年05月22日 14:40:22
On Thu, May 22, 2008 at 02:52:13PM +0200, David Simpson wrote:
> This is probably my lack of knowledge of python, but how do I set up
> legend labels for some bar-plots that have been produced inside a 
> function. For example, the following will nicely plot my bar-plots, but 
> then legend doesn't know about the colours used, so here just uses black 
> for both labels. I'd like the labels to have the same colour as the bars
> generated inside plotb. (I am using a function here as my real code has 
> extra stuff to calculate error-bars and suchlike for each data set.)
> 
> x=arange(0,5)
> y=array([ 1.2, 3.4, 5.4, 2.3, 1.0])
> z=array([ 2.2, 0.7, 0.4, 1.3, 1.2])
> 
> def plotb(x,y,col):
> p=bar(x,y,color=col)
> 
> plotb(x,y,'k')
> plotb(x+0.4,z,'y')
> 
> legend(('YYY,'ZZZ'))
>
> I tried passing the object "p" through the plotb argument list, but
> python didn't like that. (I am just learning python, and so far haven't
> seen how to pass such objects around.
You could return the plotted lines from the function plotb. 
Here is my attempt:
In [1]: x=arange(0,5)
In [2]: y=array([ 1.2, 3.4, 5.4, 2.3, 1.0])
In [3]: z=array([ 2.2, 0.7, 0.4, 1.3, 1.2])
In [4]: def plotb(x,y,col):
 ...: lines = bar(x,y,color=col)
 ...: return lines
 ...: 
In [5]: l1 = plotb(x,y,'k')
In [6]: l2 = plotb(x+0.4,z,'y')
In [7]: legend((l1[0], l2[0]), ('YYY','ZZZ'))
Out[7]: <matplotlib.legend.Legend object at 0x908dc6c>
The legend() function could label any line object. So every single bar-line
could be listed in the legend. But I think you would only have one from 
each color, so I have choosen the first: l1[0] and l2[0].
Is this what you what?
By, Friedrich
From: Chiara C. <chi...@ho...> - 2008年05月22日 14:30:30
Hello,
I would like to change the color of the yticklabels. I tried to use this command:
ax1=p.subplot(212)
ax1.set_xlabel('t [sec]')
ax1.set_ylabel('g^2(q,t)')
ax1.set_yticklabels(color='r')
but it gives an error:
TypeError: set_yticklabels() takes at least 2 non-keyword arguments (1 given)
if I write instead 
ax1.set_yticklabels(['1','2'],color='r')
it works, but it puts clearly labels 1 and 2... I don't want to change the labels, only the color! is there anyway of doing it?
Hope you can help me
Chiara
> Date: 2008年5月22日 14:52:13 +0200
> From: dav...@ch...
> To: mat...@li...
> Subject: [Matplotlib-users] Legend labels - interaction with functions
> 
> This is probably my lack of knowledge of python, but how do I set up
> legend labels for some bar-plots that have been produced inside a 
> function. For example, the following will nicely plot my bar-plots, but 
> then legend doesn't know about the colours used, so here just uses black 
> for both labels. I'd like the labels to have the same colour as the bars
> generated inside plotb. (I am using a function here as my real code has 
> extra stuff to calculate error-bars and suchlike for each data set.)
> 
> x=arange(0,5)
> y=array([ 1.2, 3.4, 5.4, 2.3, 1.0])
> z=array([ 2.2, 0.7, 0.4, 1.3, 1.2])
> 
> def plotb(x,y,col):
> p=bar(x,y,color=col)
> 
> plotb(x,y,'k')
> plotb(x+0.4,z,'y')
> 
> legend(('YYY,'ZZZ'))
> 
> 
> I tried passing the object "p" through the plotb argument list, but
> python didn't like that. (I am just learning python, and so far haven't
> seen how to pass such objects around.
> 
> Thanks for any tips,
> 
> Dave
> 
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
_________________________________________________________________
Invite your mail contacts to join your friends list with Windows Live Spaces. It's easy!
http://spaces.live.com/spacesapi.aspx?wx_action=create&wx_url=/friends.aspx&mkt=en-us 
From: David S. <dav...@ch...> - 2008年05月22日 12:53:31
This is probably my lack of knowledge of python, but how do I set up
legend labels for some bar-plots that have been produced inside a 
function. For example, the following will nicely plot my bar-plots, but 
then legend doesn't know about the colours used, so here just uses black 
for both labels. I'd like the labels to have the same colour as the bars
generated inside plotb. (I am using a function here as my real code has 
extra stuff to calculate error-bars and suchlike for each data set.)
x=arange(0,5)
y=array([ 1.2, 3.4, 5.4, 2.3, 1.0])
z=array([ 2.2, 0.7, 0.4, 1.3, 1.2])
def plotb(x,y,col):
 p=bar(x,y,color=col)
plotb(x,y,'k')
plotb(x+0.4,z,'y')
legend(('YYY,'ZZZ'))
I tried passing the object "p" through the plotb argument list, but
python didn't like that. (I am just learning python, and so far haven't
seen how to pass such objects around.
Thanks for any tips,
Dave
From: Matthias M. <Mat...@gm...> - 2008年05月22日 11:51:14
Hello,
On Wednesday 21 May 2008 17:57:28 PaterMaximus wrote:
> I want to make one scatter plot and use the same scales on another. I think
> I seen getting the Axes from the first scatter plot using v=axis() and then
> setting them on second with axis(v) but I can not get to work. Any help
> appreciated
Maybe I don't understand correctly, but what you can do with v=axis() and 
axis(v) is to get the current axes limits and apply them to another axes. 
Doing so you need to build the second axes by yourself (with axes oder 
subplot - command) and afterwards apply the limits.
regards Matthias

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