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

Showing 5 results of 5

From: Matthew C. <mat...@gm...> - 2007年03月24日 13:45:19
Hi David,
How about:
import pylab as P
dist = P.rand(100)
x=P.arange(0.,1.,0.01)
fx=10.*x**4
P.hist(dist)
P.plot(x,fx,'r-')
P.axis([0.,1.,0.,20.])
P.show()
From: David <da...@gm...> - 2007年03月24日 13:21:55
I would like to plot a function on top of a histogram, using the same 
coordinate axes. Is this possible? Or alternatively, is it possible 
to plot a function with an image as the background (so that I can 
save the histogram as an image and then use it as a background).
Thank you in advance,
/David
From: Bill B. <wb...@gm...> - 2007年03月24日 03:16:58
Did you guys make a conscious decision to have the matplotlib list
send replies only to the sender of the message rather than the list?
This seems to be the default at SourceForge, so it's conceivable you
just haven't bothered to change it. I've been on at least 10
different mailing lists in the past 2 years or so, and of those
matplotlib's is the only one I can recall being set up with default
reply-to-sender rather than reply-to-list.
I keep accidentally replying to senders only, so I thought I'd mention
it. In the admin section on sourceforge there's a checkbox you can
set to change the list from reply-to-sender to reply-to-list as the
default.
--bb
From: Bill B. <wb...@gm...> - 2007年03月24日 03:10:24
gah! bitten by reply to sender once again.
--bb
---------- Forwarded message ----------
From: Bill Baxter <wb...@gm...>
Date: Mar 24, 2007 12:09 PM
Subject: Re: [Matplotlib-users] interactive plots again
To: Robert Cimrman <cim...@nt...>
Are you sure that's threadsafe?
With most windowing toolkits it's not safe to do GUI things from
threads other than the main one. Other threads can only post a
message to the main GUI thread. Depending on how fig.canvas.draw is
implemented, calling it from another thread might not be kosher. But
I take it you haven't seen any meltdowns so far, so maybe its
implementation does the threadsafe message posting thing.
--bb
On 3/22/07, Robert Cimrman <cim...@nt...> wrote:
> Maybe I have reinvented the wheel, but I find the attached code snippet
> very useful.
> I have modified a bit the recipe at
> http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65222
> to be used in the following situation:
>
> You plot (interactively) something in a main program, which than works
> heavily. Normally, when the figure window gets obscured, it will not
> redraw. The attached code shows how to make a thread that periodically
> redraws the figure.
>
> r.
>
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys-and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
>
From: Angus M. <am...@gm...> - 2007年03月24日 01:12:02
On 24/03/07, belinda thom <bt...@cs...> wrote:
> Hi,
>
> I'm trying to write a very simple GUI using matplotlib and have
> gotten stuck. Hopefully someone out there has done something similar
> and can point me on my way.
>
> First, I should mention that the examples provided with matplotlib
> weren't immediately helpful to me, because when I try to run various
> demos (like pick_event_demo or object_picker) it fails b/c I'm
> relying on (and have to rely on) TkAgg. Sadly, I'm too new to
> understand what I would need to do to get those demos working. So I
> found someone processing mouseclicks using a Mac online and started
> there.
>
> I ended up with something like this:
>
> from pylab import *
> class gui :
> def __init__(self) :
> self.f = figure()
> self.data = None # valid mouse click hasn't yet happened
> def clicker(event):
> self.data = event.xdata
> self.f.canvas.mpl_connect("button_press_event",clicker)
>
> def getNextValidClick(self) :
> (data, self.data) = (None, None)
> while True :
> print "Waiting for valid mouse click..."
> while self.data == None :
> pass # keep polling
> if 1 <= self.data <= 3 :
> # consider this a valid next mouse click
> (data, self.data) = (self.data, None)
> break
> return data
>
> With which I tried:
>
> g = gui()
> x = g.getNextValidClick()
>
> but the latter line caused me to experience the spinning wheel of
> dead that we mac users so enjoy.
>
> I have the feeling I need to explicitly yield or some such in the
> poll loop, but I don't know how to do that.
>
> Advice greatly appreciated, both on the code I've provided, and on if
> there is a better way altogether to provide an app with data obtained
> via a matplotlib mouse click callback.
>
> Thanks,
>
> --b
It's the polling that's the problem. Why not use a slightly different
approach, like this:
---------------------------
from pylab import figure
class gui :
 def __init__(self, callback) :
 self.f = figure()
 self.ax = self.f.add_subplot(111)
 self.ax.plot([1,2,3])
 self.data = None # valid mouse click hasn't yet happened
 def clicker(event):
 self.data = event.xdata
 if 1 <= self.data <= 3:
 callback(self.data)
 self.f.canvas.mpl_connect("button_press_event",clicker)
 print "Waiting for valid mouse click..."
----------------------------
then in your application (or shell):
def my_cb(inp):
 # processing here
 print inp
g = gui(my_cb)
No polling required, and you only get the valid clicks calling your
routine. I hope that helps,
A.
-- 
AJC McMorland, PhD Student
Physiology, University of Auckland

Showing 5 results of 5

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