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

Showing 6 results of 6

From: Sebastian R. <seb...@gm...> - 2012年11月08日 15:23:48
Hi guys,
I have a problem with the "set_array" function. In a example from the
matplotlib homepage this works fine, but when I tries to adaot to my needs,
the image just stays the same. No Update, but also no error messages:
see On Timer function --> the plot is just created during the start but
never updated again. If I use imshow all the time, it works, but my
intention was not to use imshow allover, just update the image data.
Any ideas?
Cheers,
Sebi
Here is the code:
#!/usr/bin/env python
"""
"""
import sys, time, os, gc
import matplotlib
matplotlib.use('WXAgg')
from matplotlib import rcParams
import matplotlib.cm as cm
import numpy as np
import optparse
from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg
from matplotlib.backends.backend_wx import NavigationToolbar2Wx
from matplotlib.figure import Figure
from wx import *
TIMER_ID = NewId()
class PlotFigure(Frame):
 def __init__(self):
Frame.__init__(self, None, -1, "Test embedded wxFigure")
 self.fig = Figure((8,6), 100)
self.canvas = FigureCanvasWxAgg(self, -1, self.fig)
self.toolbar = NavigationToolbar2Wx(self.canvas)
self.toolbar.Realize()
 # On Windows, default frame size behaviour is incorrect
# you don't need this under Linux
tw, th = self.toolbar.GetSizeTuple()
fw, fh = self.canvas.GetSizeTuple()
self.toolbar.SetSize(Size(fw, th))
 # Create a figure manager to manage things
 # Now put all into a sizer
sizer = BoxSizer(VERTICAL)
# This way of adding to sizer allows resizing
sizer.Add(self.canvas, 1, LEFT|TOP|GROW)
# Best to allow the toolbar to resize!
sizer.Add(self.toolbar, 0, GROW)
self.SetSizer(sizer)
self.Fit()
EVT_TIMER(self, TIMER_ID, self.onTimer)
 def init_plot_data(self):
 # initialize data array and plot for the 1st time
self.data = np.zeros([96])
# create matrix which will contain the number of counted cells
well96 = np.zeros([8,12])
 # read in cell numbers
#Nr = 8 # number of rows
#Nc = 12 # number of columns
 #labelx = ['1','2','3','4','5','6','7','8','9','10','11','12']
#labely = ['A','B','C','D','E','F','G','H']
 ax1 = self.fig.add_axes([0.075,0.1,0.75,0.85])
self.cax = self.fig.add_axes([0.85,0.1,0.075,0.85])
 self.im = ax1.imshow(well96, cmap=cm.jet, interpolation='nearest')
self.fig.colorbar(self.im, cax=self.cax, orientation='vertical')
 #self.ax1.set_xticks(np.arange(0,12,1))
#self.ax1.set_xticklabels(labelx)
#self.ax1.set_yticks(np.arange(0,8,1))
#self.ax1.set_yticklabels(labely)
#self.ax1.set_title('Cell Count per Well')
 def GetToolBar(self):
# You will need to override GetToolBar if you are using an
# unmanaged toolbar in your frame
return self.toolbar
 def onTimer(self, evt):
 datain = np.loadtxt(options.filename, delimiter=';')
self.data[0:len(datain[:,1])] = datain[:,1]
welldata = self.data.reshape(8,12)
print welldata
self.im.set_array(welldata)
#self.im = self.ax1.imshow(welldata, cmap=cm.jet, interpolation='nearest')
self.fig.colorbar(self.im, cax=self.cax,orientation='vertical')
self.canvas.draw()
 def onEraseBackground(self, evt):
# this is supposed to prevent redraw flicker on some X servers...
pass
if __name__ == '__main__':
 # configure parsing option for command line usage
parser = optparse.OptionParser()
parser.add_option('-f', '--file',
action="store", dest="filename",
help="query string", default="spam")
 # read command line arguments
options, args = parser.parse_args()
print 'Filename:', options.filename
 app = PySimpleApp()
frame = PlotFigure()
frame.init_plot_data()
 # Initialise the timer - wxPython requires this to be connected to
# the receiving event handler
t = Timer(frame, TIMER_ID)
t.Start(1000)
 frame.Show()
app.MainLoop()
From: Damon M. <dam...@gm...> - 2012年11月08日 13:44:11
On Thursday, November 8, 2012, Alejandro Weinstein wrote:
> If you are in a Linux machine, you can use `inotify`: "Inotify (inode
> notify) is a Linux kernel subsystem that acts to extend filesystems to
> notice changes to the filesystem".
>
> It seems that there are a few option to use this from Python:
>
> http://pyinotify.sourceforge.net/
> http://code.activestate.com/recipes/576375-low-level-inotify-wrapper/
>
> Alejandro.
>
> On Thu, Nov 8, 2012 at 1:34 AM, Sebastian Rhode <seb...@gm...<javascript:;>>
> wrote:
> > Hi,
> >
> > I have a textfile where every second a line is written. Usually the look
> > like this:
> >
> > 1; 124; 455
> >
> > a second later
> >
> > 1; 124; 455
> > 2; 104; 600
> >
> > ...
> >
> > Finally such a file is quite easy to plot using matplotlib. But what
> would
> > be very useful for me is a script, that is watching the TXT file and
> updates
> > the plot when a new row "arrives". Any good ideas?
> >
> > Cheers,
> >
> > Sebi
> >
> >
> >
> ------------------------------------------------------------------------------
> > Everyone hates slow websites. So do we.
> > Make your web apps faster with AppDynamics
> > Download AppDynamics Lite for free today:
> > http://p.sf.net/sfu/appdyn_d2d_nov
> > _______________________________________________
> > Matplotlib-users mailing list
> > Mat...@li... <javascript:;>
> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> >
>
>
> ------------------------------------------------------------------------------
> Everyone hates slow websites. So do we.
> Make your web apps faster with AppDynamics
> Download AppDynamics Lite for free today:
> http://p.sf.net/sfu/appdyn_d2d_nov
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li... <javascript:;>
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
In bash:
watch -n1 tail file.txt
-- 
Damon McDougall
http://www.damon-is-a-geek.com
B2.39
Mathematics Institute
University of Warwick
Coventry
West Midlands
CV4 7AL
United Kingdom
From: Alejandro W. <ale...@gm...> - 2012年11月08日 13:23:21
If you are in a Linux machine, you can use `inotify`: "Inotify (inode
notify) is a Linux kernel subsystem that acts to extend filesystems to
notice changes to the filesystem".
It seems that there are a few option to use this from Python:
http://pyinotify.sourceforge.net/
http://code.activestate.com/recipes/576375-low-level-inotify-wrapper/
Alejandro.
On Thu, Nov 8, 2012 at 1:34 AM, Sebastian Rhode <seb...@gm...> wrote:
> Hi,
>
> I have a textfile where every second a line is written. Usually the look
> like this:
>
> 1; 124; 455
>
> a second later
>
> 1; 124; 455
> 2; 104; 600
>
> ...
>
> Finally such a file is quite easy to plot using matplotlib. But what would
> be very useful for me is a script, that is watching the TXT file and updates
> the plot when a new row "arrives". Any good ideas?
>
> Cheers,
>
> Sebi
>
>
> ------------------------------------------------------------------------------
> Everyone hates slow websites. So do we.
> Make your web apps faster with AppDynamics
> Download AppDynamics Lite for free today:
> http://p.sf.net/sfu/appdyn_d2d_nov
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: Miha P. <mp...@gm...> - 2012年11月08日 08:48:59
Hi,
You could use the time module.
import time
while 1:
 time.sleep(5) # freezes for 5 s
 update plot
This should be less CPU consuming ...
lpmp
On Thu, Nov 8, 2012 at 9:41 AM, francesco oteri
<fra...@gm...>wrote:
> Hi,
> what about opening-closing the file every now and then, for example every
> 5seconds?
> you can do it using the function time(). It gives you the amount of time
> since I don't kno when,
> but you can count how many seconds are left using:
>
> a=time()
> while 1:
> b=time()
> left= b-a
> if left == 5sec:
> updating plot
>
> Actually is very cpu consuming, but it is the best I can propose :(
>
>
> Francesco
>
>
>
> 2012年11月8日 Sebastian Rhode <seb...@gm...>
>
>> Hi,
>>
>> I have a textfile where every second a line is written. Usually the look
>> like this:
>>
>> 1; 124; 455
>>
>> a second later
>>
>> 1; 124; 455
>> 2; 104; 600
>>
>> ...
>>
>> Finally such a file is quite easy to plot using matplotlib. But what
>> would be very useful for me is a script, that is watching the TXT file and
>> updates the plot when a new row "arrives". Any good ideas?
>>
>> Cheers,
>>
>> Sebi
>>
>>
>>
>> ------------------------------------------------------------------------------
>> Everyone hates slow websites. So do we.
>> Make your web apps faster with AppDynamics
>> Download AppDynamics Lite for free today:
>> http://p.sf.net/sfu/appdyn_d2d_nov
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>>
>
>
> --
> Cordiali saluti, Dr.Oteri Francesco
>
>
> ------------------------------------------------------------------------------
> Everyone hates slow websites. So do we.
> Make your web apps faster with AppDynamics
> Download AppDynamics Lite for free today:
> http://p.sf.net/sfu/appdyn_d2d_nov
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
From: francesco o. <fra...@gm...> - 2012年11月08日 08:41:58
Hi,
what about opening-closing the file every now and then, for example every
5seconds?
you can do it using the function time(). It gives you the amount of time
since I don't kno when,
but you can count how many seconds are left using:
a=time()
while 1:
 b=time()
 left= b-a
 if left == 5sec:
 updating plot
Actually is very cpu consuming, but it is the best I can propose :(
Francesco
2012年11月8日 Sebastian Rhode <seb...@gm...>
> Hi,
>
> I have a textfile where every second a line is written. Usually the look
> like this:
>
> 1; 124; 455
>
> a second later
>
> 1; 124; 455
> 2; 104; 600
>
> ...
>
> Finally such a file is quite easy to plot using matplotlib. But what would
> be very useful for me is a script, that is watching the TXT file and
> updates the plot when a new row "arrives". Any good ideas?
>
> Cheers,
>
> Sebi
>
>
>
> ------------------------------------------------------------------------------
> Everyone hates slow websites. So do we.
> Make your web apps faster with AppDynamics
> Download AppDynamics Lite for free today:
> http://p.sf.net/sfu/appdyn_d2d_nov
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
-- 
Cordiali saluti, Dr.Oteri Francesco
From: Sebastian R. <seb...@gm...> - 2012年11月08日 08:35:30
Hi,
I have a textfile where every second a line is written. Usually the look
like this:
1; 124; 455
a second later
1; 124; 455
2; 104; 600
...
Finally such a file is quite easy to plot using matplotlib. But what would
be very useful for me is a script, that is watching the TXT file and
updates the plot when a new row "arrives". Any good ideas?
Cheers,
Sebi

Showing 6 results of 6

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