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

Showing 13 results of 13

From: Angus M. <am...@gm...> - 2008年10月05日 23:12:54
Hi all,
I'm trying to plot a colour bar for a scatter plot, and set the
maximum value of the plot to something arbitrary. At the moment it
always comes up as 255. How can I change this?
ax = plt.gca()
pts = ax.scatter(coords[:,0], coords[:,1], c=np.linspace(0,1,n_pts), s=16,
 edgecolors='k', linewidth=1)
Also, there seem to be many different ways to make colorbars associate
with certain objects like the colorbar keyword to scatter perhaps, but
the simplest/only way to create a colorbar that I can get to work is:
ax.figure.colorbar(ax.images[0])
Is there a better way to do this so the vmin and vmax attributes of
the scatter plot get used in the colorbar?
Thanks,
Angus.
-- 
AJC McMorland
Post-doctoral research fellow
Neurobiology, University of Pittsburgh
From: Eric F. <ef...@ha...> - 2008年10月05日 21:17:55
Jae-Joon Lee wrote:
>> Done, except that it just raises a warning, and still works with the old
>> kwarg. The new kwarg is "borderpad"; it is used if pad==0, which is the new
>> rc default. I set the default borderpad=0.5.
>>
>> There is still too much other positioning in legend that is based on axes
>> units. I briefly tried to start changing others, again with additional
>> kwargs, and things quickly fell apart. Legend needs considerable reworking
>> to take full advantage of the transforms framework (and maybe other mpl
>> improvements since the original legend) and to put all positioning kwargs
>> and code in sensible units. It is amazing that the present code works as
>> well as it does.
>>
>> The way to make a transition may be via a separate version for a while.
>> There could be a single interface, with a kwarg to choose the version.
>>
> 
> Thanks Eric.
> 
> I would like to help reworking on the legend class.
> I once tried to incorporate the FancyBox into the legend but the
> result is not satisfactory because the legend bounding box is defined
> as axes units in the current implementation (see the attached
> screenshot). And I guess it would be better do things in the display
> coordinate.
> 
> Also, in the current implementation, the vertical spacing between each
> legend varies according to the height of the legend text. For example,
> in the attached screenshot, the spacings between "ac", "ag", "lg" are
> all different and this is because their text heights are different. I
> think it is better if we have a fixed spacing, or have a minimum
> spacing as the text height of "lg". And use the baseline-alignment if
> possible.
Jae-Joon,
It would be great if you would take this on. I agree about the spacing. 
I suspect there are good opportunities for factoring out parts of the 
problem in such a way that they can be used more flexibly in legend, and 
may turn out to be useful elsewhere. An ability to nicely format plot 
elements (line segments, etc.) with text into a block would facilitate 
satisfying another request that has come up: a legend with more than one 
column, or a legend that is entirely horizontal.
Eric
From: Vincent Favre-N. <vi...@us...> - 2008年10月05日 21:09:42
On dimanche 05 octobre 2008, jcarnes wrote:
> I am writing a GUI application in wxPython and using MPL that plots
> figures, saves them to image files, and then closes them all from within a
> thread to keep the GUI responsive.
 Normally only the main thread should alter the graphics - you'll have 
crashes if you try to do it otherwise. If you want to perform calculations in 
a separate thread to keep the GUI responsive, you have to send an event from 
the working thread to the main thread, so that the main thread does the GUI 
update.
http://docs.wxwidgets.org/stable/wx_wxthreadoverview.html#wxthreadoverview
 Well, at least that's the story from my C++ wx knowledge, but it is 
probably still valid in Python.
Another interesting read from the samples page:
http://docs.wxwidgets.org/trunk/page_samples.html#page_samples_thread
 Maybe simply using wxMutexGUIEnter() / wxMutexGUILeave() will sort your 
problems, but I've not tried this method.
	Vincent
-- 
Vincent Favre-Nicolin
CEA Grenoble/INAC/SP2M			http://inac.cea.fr
Univ. Joseph Fourier (Grenoble) http://www.ujf-grenoble.fr
ObjCryst & Fox			http://objcryst.sf.net/Fox
From: Jae-Joon L. <lee...@gm...> - 2008年10月05日 20:53:42
Attachments: t.png
>
> Done, except that it just raises a warning, and still works with the old
> kwarg. The new kwarg is "borderpad"; it is used if pad==0, which is the new
> rc default. I set the default borderpad=0.5.
>
> There is still too much other positioning in legend that is based on axes
> units. I briefly tried to start changing others, again with additional
> kwargs, and things quickly fell apart. Legend needs considerable reworking
> to take full advantage of the transforms framework (and maybe other mpl
> improvements since the original legend) and to put all positioning kwargs
> and code in sensible units. It is amazing that the present code works as
> well as it does.
>
> The way to make a transition may be via a separate version for a while.
> There could be a single interface, with a kwarg to choose the version.
>
Thanks Eric.
I would like to help reworking on the legend class.
I once tried to incorporate the FancyBox into the legend but the
result is not satisfactory because the legend bounding box is defined
as axes units in the current implementation (see the attached
screenshot). And I guess it would be better do things in the display
coordinate.
Also, in the current implementation, the vertical spacing between each
legend varies according to the height of the legend text. For example,
in the attached screenshot, the spacings between "ac", "ag", "lg" are
all different and this is because their text heights are different. I
think it is better if we have a fixed spacing, or have a minimum
spacing as the text height of "lg". And use the baseline-alignment if
possible.
Regards,
-JJ
From: Jon F. <jfr...@cs...> - 2008年10月05日 19:46:27
Back in March, 2007, a user asked about getting the resize_even to work. 
No one responded to his question. I have the same problem. I tried 
hooking up a method that I hoped would be called every time the graph 
was resized (using the UI that is displayed by a show() call).
connect('resize_event', plotutils.recalculateTimeSeriesXLabels)
However, my method is never called, even when I maximize the window.
Here is his email as well:
Trying to get resize event to work, but either I don't understand the 
definition of when resize_event should work, or it's broken.
for example
=======================
from matplotlib import pylab , numerix
def GotResizeEvent( event ):
 print 'Resize event detected'
def GotDrawEvent( event ):
 print 'Draw event detected'
X = range(0, 200)
Y = pylab.sin(X)
r = pylab.plot(X,Y)
pylab.connect( 'resize_event', GotResizeEvent)
pylab.connect( 'draw_event', GotDrawEvent)
pylab.show()
=========================
Will only get draw_events as I zoom in on the data, never a resize event?
I also get draw_events as I resize the window itself, but never a 
resize_event.
So my question, .. what user activity triggers a resize event?
-- 
Jon Froehlich
PhD Student
Computer Science and Engineering
University of Washington
http://www.cs.washington.edu/homes/jfroehli
From: Venkat R. <ve...@sr...> - 2008年10月05日 17:00:14
Hi all,
I'm trying to install the latest matplotlib on a couple of machines.
They both run the same OS (an old custom version between Fedora 2 and 3) 
but the rest of the setup are rather different. For the curious, one is 
an MR scanner and the other is a developmental machine for compiling 
pulse-sequences etc.
I have root permissions on both, but would rather not disturb the 
installed directory tree. What is the best/recommended way of going 
about it?
1. Is it possible to install matplotlib ( and its requirements ) in the 
developmental machine in a separate root directory, export it and mount 
from the other machine? The idea is to install once and use those from 
both. Would this work? What backends would work on this setup?
2. This is to be used for dynamically plotting the data coming out of 
the scanner. I'm also thinking of embedding it in an UI. Can all the UI 
backends handle the rate of about 10 FPS with each data ~5K short-ints?
Thanks for your time,
Venkat.
From: John H. <jd...@gm...> - 2008年10月05日 13:36:50
On Sun, Oct 5, 2008 at 3:50 AM, rocha <ber...@me...> wrote:
>>> self.canvas.figure.clf()
>>> self.canvas.draw()
>>> self.canvas.axes.plot([1.,2.,4.])
>>>
>>> and nothing is plotted. The Figure is totally gray. I tried to do the
>>> same thing in embedding_in_qt4.py example, modifying some parts, but it
>>> didn't work too.
>>>
>>> Do you have any suggestions?
The problem appears to be that you have kept a copy of your old axes
around (self.canvas.axes is not a mpl construct, so it looks like you
have attached an axes instance to your canvas instance). You will
want to either not clear your figure and clear your axes instead
 ax.cla()
 ax.plot([1,2,3])
 canvas.draw()
or clear your figure, create a new axes, plot and then draw
 fig.clf()
 ax = fig.add_subplot(111)
 ax.plot([1,2,3])
 ax.draw()
Be careful with the name "axes" to refer to a single axes instance
attached to your canvas. In the mpl scheme, axes is a list of Axes
instance and is attached to the Figure instance. See for example
 http://matplotlib.sourceforge.net/doc/html/users/artists.html
JDH
From: Jouni K. S. <jk...@ik...> - 2008年10月05日 10:28:16
ber...@xn... (Berthold
Höllmann) writes:
> (Pdb) print self._header
> {'Notice': 'Copyright (c) 1999 Ministry of Education, Taipei, Taiwan. All Rights Reserved.', 'Ascender': 880.0, 'FontBBox': [-123, -250, 1000, 880], 'Weight': 'Regular', 'Descender': -250.0, 'CharacterSet': 'Adobe-CNS1-0', 'IsFixedPitch': False, 'FontName': 'MOEKai-Regular', 'StartFontMetrics': 4.0999999999999996, 'CapHeight': 880.0, 'Version': '1.000', 'UnderlinePosition': -100, 'Characters': 13699, 'UnderlineThickness': 50, 'ItalicAngle': 0.0, 'StartCharMetrics': 13699}
That AFM file doesn't include a family name or a full name for the font
it describes. It seems that both are in fact optional attributes. I have
committed a change (on the trunk, and in the maintenance branch) that
should fix this, but since I don't have any AFM files like this, I can't
check that it works. Can you check out either the trunk or the
maintenance branch from Subversion, or apply the following patch and try
again?
-- 
Jouni K. Seppänen
http://www.iki.fi/jks
From: rocha <ber...@me...> - 2008年10月05日 08:53:27
Attachments: embedding_in_qt4.py
Hi Jae-Joon Lee,
I tried it but unfortunately it didn't work too. After the Figure is 
cleared I cannot plot again.
I've attached the whole code that I'm trying to do this, I hope it could 
help a little bit. I modified the original example just to test this 
feature.
Thanks!
Bernardo M. Rocha
Jae-Joon Lee wrote:
> I guess you need to put draw() after plot()
>
> self.canvas.figure.clf()
> self.canvas.axes.plot([1.,2.,4.])
> self.canvas.draw()
>
> Let us know if it does not help.
>
> -JJ
>
>
>
> On Sat, Oct 4, 2008 at 7:17 PM, rocha <ber...@me...> wrote:
> 
>> Hi Guys,
>>
>> I need to clear the Figure after the user has clicked the some button in
>> PyQt, but when I try to plot the graphics again nothing appear. In
>> ipython it works, but when I try it inside my application it does not
>> work. What am I missing?
>>
>> Inside my MplCanvas class (actually it is a QWidget - see
>> embedding_in_qt4.py in matplotlib examples file - user_interface) I have
>> this code:
>>
>> self.fig = Figure(figsize=(self.width, self.height), dpi=dpi)
>>
>> And then in my main application I'm trying to do:
>>
>> self.canvas.figure.clf()
>> self.canvas.draw()
>> self.canvas.axes.plot([1.,2.,4.])
>>
>> and nothing is plotted. The Figure is totally gray. I tried to do the
>> same thing in embedding_in_qt4.py example, modifying some parts, but it
>> didn't work too.
>>
>> Do you have any suggestions?
>>
>> Thanks!
>> Best regards,
>> Bernardo M. Rocha
>>
>> -------------------------------------------------------------------------
>> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
>> Build the coolest Linux based applications with Moblin SDK & win great prizes
>> Grand prize is a trip for two to an Open Source event anywhere in the world
>> http://moblin-contest.org/redirect.php?banner_id=100&url=/
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>> 
From: Eric F. <ef...@ha...> - 2008年10月05日 04:38:40
Eric Firing wrote:
> Fabrice Silva wrote:
>> Le mardi 09 septembre 2008 à 08:26 -0400, Michael Droettboom a écrit :
>>> You can use
>>>
>>> def ticklabel_format(self, **kwargs):
>> It did not figure how to use that!
>> I've tried in ipython :
>> import numpy as np
>> t = np.linspace(0,1,1024)
>> f = np.sin(10*t)/1e5
>> plot(t,f)
>> ax = gca()
>> ax.ticklabel_format(style='sci', axis='y')
> 
> ax.yaxis.major.formatter.set_powerlimits((0,0))
> 
>> show()
>>
>> but the yticklabels are still in plain notation...
>> I've googled, but I still can not find where I am wrong!
> 
> Yes, this is confusing. The problem is that the "scientific" style uses 
> scientific notation only for sufficiently large or small numbers, with 
> thresholds determined by the powerlimits parameter. The line I added 
> above will force scientific notation.
> 
> The ticklabel_format method needs another kwarg to enable setting the 
> powerlimits.
Done in svn 6148. I called the kwarg 'scilimits' to emphasize that it 
works with the 'sci' style; if there are comments to the effect that I 
should have called it 'powerlimits' for consistency with the 
corresponding ScalarFormatter method, I can change it.
With the change in svn, instead of the line I added above, your call to 
ticklabel_format would be:
ax.ticklabel_format(style='sci', scilimits=(0,0), axis='y')
Eric
From: Eric F. <ef...@ha...> - 2008年10月05日 03:44:43
Fabrice Silva wrote:
> Le mardi 09 septembre 2008 à 08:26 -0400, Michael Droettboom a écrit :
>> You can use
>>
>> def ticklabel_format(self, **kwargs):
> It did not figure how to use that!
> I've tried in ipython :
> import numpy as np
> t = np.linspace(0,1,1024)
> f = np.sin(10*t)/1e5
> plot(t,f)
> ax = gca()
> ax.ticklabel_format(style='sci', axis='y')
 ax.yaxis.major.formatter.set_powerlimits((0,0))
> show()
> 
> but the yticklabels are still in plain notation...
> I've googled, but I still can not find where I am wrong!
Yes, this is confusing. The problem is that the "scientific" style uses 
scientific notation only for sufficiently large or small numbers, with 
thresholds determined by the powerlimits parameter. The line I added 
above will force scientific notation.
The ticklabel_format method needs another kwarg to enable setting the 
powerlimits.
Eric
From: Eric F. <ef...@ha...> - 2008年10月05日 02:40:14
John Hunter wrote:
> On Tue, Sep 30, 2008 at 5:07 PM, Jae-Joon Lee <lee...@gm...> wrote:
> 
>> The problem is already well explained by Eric. And my solution is to
>> interpret the legend.pad as a fraction of the textsize (pad=0.3 seems
>> to work fine in my eyes). Note that this breaks the backward
>> compatibility. I personally think the original behavior may have
>> produced unsatisfactory results in most of the cases and keeping it as
>> a default may not be a good idea. While I hope others come out with an
>> elegant solution, I prefer to break the API in this case.
> 
> How about using a new kwarg and raising an exception if the old one is
> passed in, with the exception pointing to the new arg? I am a little
> uncomfortable silently changing the meaning of the old arg.
Done, except that it just raises a warning, and still works with the old 
kwarg. The new kwarg is "borderpad"; it is used if pad==0, which is the 
new rc default. I set the default borderpad=0.5.
There is still too much other positioning in legend that is based on 
axes units. I briefly tried to start changing others, again with 
additional kwargs, and things quickly fell apart. Legend needs 
considerable reworking to take full advantage of the transforms 
framework (and maybe other mpl improvements since the original legend) 
and to put all positioning kwargs and code in sensible units. It is 
amazing that the present code works as well as it does.
The way to make a transition may be via a separate version for a while.
There could be a single interface, with a kwarg to choose the version.
Eric
From: Jae-Joon L. <lee...@gm...> - 2008年10月05日 00:01:48
I guess you need to put draw() after plot()
self.canvas.figure.clf()
self.canvas.axes.plot([1.,2.,4.])
self.canvas.draw()
Let us know if it does not help.
-JJ
On Sat, Oct 4, 2008 at 7:17 PM, rocha <ber...@me...> wrote:
> Hi Guys,
>
> I need to clear the Figure after the user has clicked the some button in
> PyQt, but when I try to plot the graphics again nothing appear. In
> ipython it works, but when I try it inside my application it does not
> work. What am I missing?
>
> Inside my MplCanvas class (actually it is a QWidget - see
> embedding_in_qt4.py in matplotlib examples file - user_interface) I have
> this code:
>
> self.fig = Figure(figsize=(self.width, self.height), dpi=dpi)
>
> And then in my main application I'm trying to do:
>
> self.canvas.figure.clf()
> self.canvas.draw()
> self.canvas.axes.plot([1.,2.,4.])
>
> and nothing is plotted. The Figure is totally gray. I tried to do the
> same thing in embedding_in_qt4.py example, modifying some parts, but it
> didn't work too.
>
> Do you have any suggestions?
>
> Thanks!
> Best regards,
> Bernardo M. Rocha
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>

Showing 13 results of 13

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