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 14 results of 14

From: Nicolas P. <nic...@gm...> - 2009年06月03日 21:53:23
Hi,
I noticed that vertical and horizontal lines with a line width < 1 are 
displayed with a line width of 1 on WxAgg with recent version of matplotlib.
I use matplotlib 0.98.5.2 on Windows XP, and Ubuntu Linux 9.04.
For example :
 >>> import pylab
 >>> pylab.plot([0,0],[0,1],linewidth=*0.5*)
[<matplotlib.lines.Line2D object at 0x031FE510>]
 >>> pylab.show()
and
 >>> import pylab
 >>> pylab.plot([0,0],[0,1],linewidth=*1*)
[<matplotlib.lines.Line2D object at 0x031FE510>]
 >>> pylab.show()
produce the same result.
The same bug occurs when I export the figure as a png (but not on pdf 
export). It did not occur on earlier matplotlib releases (at least, not 
on 0.91.2).
Sorry if this is a known bug, or even an already corrected one, but I 
couldn't find any mention of it on Sourceforge last changelog, nor 
elsewhere.
Nicolas
From: Sebastian H. <seb...@gm...> - 2009年06月03日 20:34:05
Hi,
I am still using the old "plt" package that used to be part of SciPy (
I fixed it up, kept it alive and it runs now fine with numpy).
I would really like to switch to matplotlib (using the wx backend) but
I'm having concerns regarding speed.
So I was wondering what are other people's speed benchmarks are like
-- to do something like a simple
>>> a = numpy.arange(500)
>>> mpl.plot(a)
I timed it and it took something like 50ms for a repeat of the plot command.
With my plt plotting package it is probably 10-50x faster.
I want to interactively plot and update (using the clear and plot
commands) things like image "line profiles" i.e. 512 points graphs.
Another example is that I started playing with ODEs (like
http://www.scipy.org/LoktaVolterraTutorial) and tried to make a small
gui to (like a Trait slider) for some parameters and the plotting
would make it completely unresponsive (plt worked again very fast --
super ugly, but fast ;-) )
Is there a special way to update plots very fast, i.e. faster than
clr();plot(...) ?
Regards,
Sebastian Haase
From: John H. <jd...@gm...> - 2009年06月03日 19:18:23
On Wed, Jun 3, 2009 at 12:33 PM, TP <par...@fr...> wrote:
> Hi everybody,
>
> I want to delete a subplot from my figure. How to do that?
>
> For example, I would like to remove the right subplot in the following
> example:
>
> ########################
> from pylab import *
>
> ion()
> f = figure()
> s = f.add_subplot("121")
> X1 = arange( 0.0, 5.0, 0.1 )
> s.plot( X1, X1**2)
>
> s = f.add_subplot("122")
> s.plot( X1, sqrt( X1 ))
Hmm, I didn't know you could pass a string in for the subplot arg :-)
Call f.delaxes(s) where s is the subplot instance you want to remove
JDH
From: Amit <ror...@gm...> - 2009年06月03日 18:43:19
Thanks John. The bar_stacked example does not seem to work for histograms, but I'm glad to know that we could manually make the legends. 
I still do not know how to specify the colors of the "stacks" in my histogram, so adding the manual legends for them is still a pain -- but at least doable since I can figure it out from the actual data.
best,
amit shrestha
John Hunter wrote:
> On Tue, Jun 2, 2009 at 3:15 PM, Amit <ror...@gm...> wrote:
> 
>> Hi all,
>>
>> Has any of you had any luck with creating stacked histograms using
>> matplotlib? It seems to work but I have no idea how to label (or add the
>> legend) or choose the colors of the stacks. Below is a sample code for
>> creating a stacked histogram. Can anyone help please? Unlike the "bar()"
>> function, hist() doesn't seem to have the color/colors parameter.
>>
>> #!/usr/bin/python
>>
>> import sys
>> import matplotlib.pyplot as pyplot
>> import numpy as numpy
>>
>> page_numbers_one = (100,100,500,600,800)
>> page_numbers_two = (100,100,500,600,800,100,100,100,100,100)
>> page_numbers_three = (900,100,500,600,800,500)
>>
>> pyplot.hist((page_numbers_one,page_numbers_two,page_numbers_three),histtype='barstacked',bins=5)
>>
>> pyplot.show()
>>
>> 
>
> Have you seen this example:
>
> http://matplotlib.sourceforge.net/examples/pylab_examples/bar_stacked.html
>
> To create the legend, it is best to create proxy objects, eg
> Rectangles, with the right colors and manually add them to the legend.
> See
>
> http://matplotlib.sourceforge.net/users/plotting/legend.html#using-proxy-artist
>
> JDH
> 
From: TP <par...@fr...> - 2009年06月03日 18:35:51
Hi everybody,
I want to delete a subplot from my figure. How to do that?
For example, I would like to remove the right subplot in the following
example:
########################
from pylab import *
ion()
f = figure()
s = f.add_subplot("121")
X1 = arange( 0.0, 5.0, 0.1 )
s.plot( X1, X1**2)
s = f.add_subplot("122")
s.plot( X1, sqrt( X1 ))
show()
########################
Thanks in advance,
Julien
-- 
python -c "print ''.join([chr(154 - ord(c)) for c in '*9(9&(18%.\
9&1+,\'Z4(55l4('])"
"When a distinguished but elderly scientist states that something is
possible, he is almost certainly right. When he states that something is
impossible, he is very probably wrong." (first law of AC Clarke)
From: Michael D. <md...@st...> - 2009年06月03日 13:24:31
Can you provide a standalone script that causes the segfault so we can 
try to reproduce? Backtraces from gdb and valgrind "memcheck" logs 
would also be helpful.
Mike
Kazansky, Stella (SKAZANSK) wrote:
>
> Hello,
> I am not sure that matplotlib is the cause, we are looking for it, but 
> we are having multiple segfaults using python 2.6 on 64 bits linux boxes.
>
> Everything was recompiled for 64 bits.
> Did anybody encounter similar problem?
>
> Thanks
>
> ------------------------------------------------------------------------
>
> ------------------------------------------------------------------------------
> 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
> 
-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA
From: Kazansky, S. (SKAZANSK) <SKA...@ar...> - 2009年06月03日 13:15:30
Attachments: smime.p7s
 Hello,
I am not sure that matplotlib is the cause, we are looking for it, but we
are having multiple segfaults using python 2.6 on 64 bits linux boxes.
Everything was recompiled for 64 bits.
Did anybody encounter similar problem?
Thanks
From: John H. <jd...@gm...> - 2009年06月03日 13:11:09
On Tue, Jun 2, 2009 at 10:09 AM, Anu Pakanati <apa...@ho...> wrote:
> Lastly, my gcc version is gcc version 4.3.3 (Ubuntu 4.3.3-5ubuntu4)
>
> I did have matplotlib and player/stage playing nicely in a previous
> incarnation, using older versions of both from about 8 months ago.
> Unfortunately going back is not an option for me, and since this seems like
> it may be a third party conflict, I may need to refactor my code to avoid
> loading both in the same script. But any help would be appreciated!
>
> Thanks for your attention!
We've seen this before -- where importing matplotlib/pylab and some
other application trigger some strange interference. Unfortunately,
we've never figured it out. I've always suspected that there may be
two libraries compiled against different versions of numpy/numeric
that may be causing trouble, but this is just a hunch. Did you
compile numpy, mpl and player/stage from src, or was one or more of
them provided by an installer. I suggest trying clean src builds of
all, and then posting back. Also, do some ldd's on the python
extension code modules, and post some of the results here. Perhaps
something will jump out at me (not holding breath).
JDH
From: John H. <jd...@gm...> - 2009年06月03日 13:06:46
On Tue, Jun 2, 2009 at 3:15 PM, Amit <ror...@gm...> wrote:
> Hi all,
>
> Has any of you had any luck with creating stacked histograms using
> matplotlib? It seems to work but I have no idea how to label (or add the
> legend) or choose the colors of the stacks. Below is a sample code for
> creating a stacked histogram. Can anyone help please? Unlike the "bar()"
> function, hist() doesn't seem to have the color/colors parameter.
>
> #!/usr/bin/python
>
> import sys
> import matplotlib.pyplot as pyplot
> import numpy as numpy
>
> page_numbers_one = (100,100,500,600,800)
> page_numbers_two = (100,100,500,600,800,100,100,100,100,100)
> page_numbers_three = (900,100,500,600,800,500)
>
> pyplot.hist((page_numbers_one,page_numbers_two,page_numbers_three),histtype='barstacked',bins=5)
>
> pyplot.show()
>
Have you seen this example:
 http://matplotlib.sourceforge.net/examples/pylab_examples/bar_stacked.html
To create the legend, it is best to create proxy objects, eg
Rectangles, with the right colors and manually add them to the legend.
See
 http://matplotlib.sourceforge.net/users/plotting/legend.html#using-proxy-artist
JDH
From: Ole S. <ole...@gm...> - 2009年06月03日 13:05:12
Hi again,
I have another problem: I try to connect "Control + mouse drag" to some
zoom event. On mouse press, I need to check whether the Ctrol key is
pressed:
------------------------------------8<------------------------------------
import random
import sys
from PyQt4 import QtGui, QtCore
from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas
from matplotlib.figure import Figure,SubplotParams
class InnerDiagramWidget(FigureCanvas):
 def __init__(self, parent):
 fig = Figure()
 fig.add_subplot(111)
 FigureCanvas.__init__(self, fig)
 self.setParent(parent)
 self.mpl_connect('button_press_event', self.on_button_press)
 def on_button_press(self, event):
 print event.key, event.button, event.xdata
 if event.key == 'control':
 print 'This should start the zoom but never happens'
a = QtGui.QApplication(sys.argv)
w = QtGui.QMainWindow()
w.setCentralWidget(InnerDiagramWidget(w))
w.show()
a.exec_()
------------------------------------8<------------------------------------
The key returned here is always None. Why??? The API
(matplotlib.backend_bases.MouseEvent) says that it should return
"control"?
$ uname -a
Linux myos 2.6.27.21-0.1-default #1 SMP 2009年03月31日 14:50:44 +0200 x86_64 x86_64 x86_64 GNU/Linux
$ python -c "import matplotlib; print matplotlib.__version__"
0.98.5.2
I guess this is a bug in matplotlib? Can one confirm that?
Best regards
Ole
From: Jae-Joon L. <lee...@gm...> - 2009年06月03日 10:00:18
On Wed, Jun 3, 2009 at 2:11 AM, Paul Anton Letnes
<pau...@gm...> wrote:
> Is this complete enough? If you do the plot, you'll see that the plot
Unfortunately not. It is best if you post a stand-alone script that we
can simply run with copy-and-paste.
> 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.
Please be more specific why you think the legend looks large, e.g.,
too much line-spacing, too long handle length, too much padding, etc.
I think the legend has an adequate size in my view, even with your
configuration. You may post the output of gnuplot and compare it with
the output of matplotlib. Also, let us know what version of mpl you're
using. The legend function has recently undergone some changes.
You can customize most of spacing parameters of the legend. Take a
look at the documentation.
http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.legend
The default figure size is 8 inch x 6 inch, and most of other
parameters are tuned for this setup. And some of these default
parameters won't work well if you simply create a figure of very small
size. My personal approach is to create a figure with a default size
(or some slight adjustment) and do not worry about other parameters,
and simply scale down the output eps file itself when I include it in
the latex document.
Regards,
-JJ
From: Chaitanya K. <ic...@gm...> - 2009年06月03日 06:26:29
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: Paul A. L. <pau...@gm...> - 2009年06月03日 06:11:12
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.
From: Astronomical P. <ast...@gm...> - 2009年06月03日 04:05:17
We are pleased to announce the release of APLpy 0.9.2.
APLpy is a python module that makes it easy to interactively produce
publication-quality plots of astronomical images in FITS format. More
details are available at
 http://aplpy.sourceforge.net/
>From the front page you can sign up to the mailing list and/or the Twitter
feed to be kept up-to-date on future releases.
This release contains a significant improvement to the initial loading
time of the FITSFigure instances, fixes compatibility issues with the
latest version of matplotlib, and fixes an issue that occured with images
projected in Plate Carrée (-CAR).
Cheers,
Eli Bressert and Thomas Robitaille

Showing 14 results of 14

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