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
(1) |
2
|
3
|
4
|
5
(10) |
6
|
7
(3) |
|
8
(5) |
9
|
10
(3) |
11
(1) |
12
(16) |
13
(1) |
14
|
|
15
(5) |
16
(5) |
17
(4) |
18
(2) |
19
(9) |
20
(4) |
21
(2) |
|
22
|
23
(1) |
24
|
25
(4) |
26
(6) |
27
(9) |
28
(1) |
|
29
(2) |
30
|
|
|
|
|
|
|
From: Eric F. <ef...@ha...> - 2014-06-21 15:22:27
|
On 2014/06/21, 3:39 PM, 不坏阿峰 wrote: > is there someone can help me ? Posting a *simple*, self-contained example as a starting point would make it more likely that someone would understand your question. Leave out everything that is irrelevant--I suspect all the gui and threading code is in that category. Also, although it is not directly related to your question, please note that you are using a horrible mixture of backend invocations, and even if it works now, it will do you no good in the long run. See the embedding examples: no matplotlib.use, no pylab, one and only one gui toolkit. I also suspect the answer to your question is at least partly in one of the examples of plotting with dates; dates and times are handled together. Here is one such example: http://matplotlib.org/examples/pylab_examples/date_demo1.html Eric > many thanks > > > 2014-06-19 19:36 GMT+07:00 不坏阿峰 <onl...@gm... > <mailto:onl...@gm...>>: > > Dear all > > could some expert can help me. > I have modify from one demo. but i do not how to change the x_lable > to time like H:M:S, and can move it. i have try some way, but failed. > > hope some expert can do me a favor. > thanks a lot > > ###################### > # coding=utf-8 > import os > import pprint > import random, time > import sys > from PyQt4 import QtGui, QtCore > from threading import * > import time > import datetime > > import matplotlib > matplotlib.use('WXAgg') > from matplotlib.figure import Figure > from matplotlib.backends.backend_qt4agg import \ > FigureCanvasQTAgg as FigCanvas, \ > NavigationToolbar2QT as NavigationToolbar > import numpy as np > import pylab > class DataGen(object): > """ A silly class that generates pseudo-random data for > display in the plot. > """ > def __init__(self, init=50): > self.data = self.init = init > def next(self): > self._recalc_data() > return self.data > def _recalc_data(self): > delta = random.uniform(-0.5, 0.5) > r = random.random() > if r > 0.9: > self.data += delta * 15 > elif r > 0.8: > # attraction to the initial value > delta += (0.5 if self.init > self.data else -0.5) > self.data += delta > else: > self.data += delta > > class myThing(): > class myThread(Thread): > def __init__(self): > Thread.__init__(self) > self.running = True > self.vec = [0] > self.dg = DataGen() > > print "Initializing myThread..." > > def run(self): > print "Running myThread..." > while self.running: > time.sleep(1) > self.vec.append(self.dg.next()) > print "Splat" > def getVec(self): > return self.vec > def stop(self): > self.running = False > def __init__(self): > self.theThread = self.myThread() > self.threadRunning = True > print "initializing myThing..." > self.theThread.start() > def __del__(self): > self.theThread.stop() > def getVec(self): > #print self.theThread.vec[:] > return self.theThread.vec[:] > class ApplicationWindow(QtGui.QMainWindow): > """ The main window of the application > """ > def __init__(self): > QtGui.QMainWindow.__init__(self) > self.setAttribute(QtCore.Qt.WA_DeleteOnClose) > self.setWindowTitle('Demo: dynamic matplotlib graph') > self.thing1 = myThing() > self.thing2 = myThing() > self.starttime = int(time.time()) > > > self.create_menu() > #self.create_status_bar() > self.create_main_panel() > self.redraw_timer = QtCore.QTimer(self) > QtCore.QObject.connect(self.redraw_timer, > QtCore.SIGNAL("timeout()"), self.on_redraw_timer) > self.redraw_timer.start(4000) > def create_menu(self): > menu_file = QtGui.QMenu("&File", self) > #menu_file.addAction(u'&Save plot', self.on_save_plot, > # QtCore.Qt.CTRL + QtCore.Qt.Key_S) > menu_file.addSeparator() > menu_file.addAction(u'E&xit', self.on_exit, > QtCore.Qt.CTRL + QtCore.Qt.Key_X) > self.menuBar().addMenu(menu_file) > def create_main_panel(self): > self.panel = QtGui.QFrame(self) > self.setCentralWidget(self.panel) > self.init_plot() > self.canvas = FigCanvas(self.fig) > self.canvas.setMinimumHeight(150) > #self.toolbar = NavigationToolbar(self.canvas, None) > self.vbox = QtGui.QVBoxLayout() > self.vbox.addWidget(self.canvas) > > self.panel.setLayout(self.vbox) > #self.vbox.Fit(self) > self.unit = 20 > width, height = self.geometry().width(), > self.geometry().height() > self.show() > def init_plot(self): > self.dpi = 100 > self.fig = Figure((5.0, 3.0), dpi=self.dpi) > self.axes = self.fig.add_subplot(111, navigate=False) > self.axes.set_axis_bgcolor('black') > > self.axes.set_title('Very important random data', size=10) > self.axes.set_xlabel('Time flies like an arrow',size=10) > self.axes.set_ylabel('Random is just random',size=10) > pylab.setp(self.axes.get_xticklabels(), fontsize=8) > pylab.setp(self.axes.get_yticklabels(), fontsize=8) > self.plot_data = self.axes.plot( > self.thing1.getVec(), > linewidth=0.5, > color=(1, 1, 0), > #marker='o', > label="set1", > )[0] > print self.thing1.getVec(), "<<>>" > self.plot_data2 = self.axes.plot( > self.thing2.getVec(), > linewidth=1, > dashes=[.2, .4], > color=(0, 1, 1), > label="set2", > )[0] > > > def draw_plot(self): > """ Redraws the plot > """ > self.data = self.thing1.getVec() > self.data2 = self.thing2.getVec() > def do_cal(urdata): > newdata = [] > for x in range(len(urdata)): > urtime = x + self.starttime > newdata.append(urtime) > return newdata > > xmax = len(self.data) if len(self.data) > 50 else 50 > > xmin = xmax - 50 > > min1 = min(self.data) > min2 = min(self.data2) > theMin = min(min1, min2) > > ymin = round(theMin, 0) - 1 > > max1 = max(self.data) > max2 = max(self.data2) > theMax = max(max1, max2) > > ymax = round(theMax, 0) + 1 > > self.axes.set_xbound(lower=xmin, upper=xmax) > self.axes.set_ybound(lower=ymin, upper=ymax) > > self.axes.grid(True, color='gray') > pylab.setp(self.axes.get_xticklabels(), > visible=True) > > self.plot_data.set_xdata(np.arange(len(self.data))) > self.plot_data.set_ydata(np.array(self.data)) > self.plot_data2.set_xdata(np.arange(len(self.data2))) > #self.plot_data2.set_xdata(np.array(newdata2)) > self.plot_data2.set_ydata(np.array(self.data2)) > > self.canvas.draw() > def on_redraw_timer(self): > self.draw_plot() > def on_exit(self): > self.close() > def closeEvent(self, event): > for thing in (self.thing1, self.thing2): > thing.theThread.stop() > thing.theThread.join() > if __name__ == '__main__': > app = QtGui.QApplication(sys.argv) > aw = ApplicationWindow() > aw.show() > sys.exit(app.exec_()) > > ################################# > 内嵌图片 1 > > > > > ------------------------------------------------------------------------------ > HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions > Find What Matters Most in Your Big Data with HPCC Systems > Open Source. Fast. Scalable. Simple. Ideal for Dirty Data. > Leverages Graph Analysis for Fast Processing & Easy Data Exploration > http://p.sf.net/sfu/hpccsystems > > > > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > |
|
From: 不坏阿峰 <onl...@gm...> - 2014-06-21 13:39:15
|
is there someone can help me ?
many thanks
2014-06-19 19:36 GMT+07:00 不坏阿峰 <onl...@gm...>:
> Dear all
>
> could some expert can help me.
> I have modify from one demo. but i do not how to change the x_lable to
> time like H:M:S, and can move it. i have try some way, but failed.
>
> hope some expert can do me a favor.
> thanks a lot
>
> ######################
> # coding=utf-8
> import os
> import pprint
> import random, time
> import sys
> from PyQt4 import QtGui, QtCore
>
> from threading import *
> import time
> import datetime
>
> import matplotlib
> matplotlib.use('WXAgg')
> from matplotlib.figure import Figure
> from matplotlib.backends.backend_qt4agg import \
> FigureCanvasQTAgg as FigCanvas, \
> NavigationToolbar2QT as NavigationToolbar
> import numpy as np
> import pylab
>
>
> class DataGen(object):
> """ A silly class that generates pseudo-random data for
> display in the plot.
> """
> def __init__(self, init=50):
> self.data = self.init = init
>
> def next(self):
> self._recalc_data()
> return self.data
>
> def _recalc_data(self):
> delta = random.uniform(-0.5, 0.5)
> r = random.random()
>
> if r > 0.9:
> self.data += delta * 15
> elif r > 0.8:
> # attraction to the initial value
> delta += (0.5 if self.init > self.data else -0.5)
> self.data += delta
> else:
> self.data += delta
>
> class myThing():
> class myThread(Thread):
> def __init__(self):
> Thread.__init__(self)
> self.running = True
> self.vec = [0]
> self.dg = DataGen()
>
> print "Initializing myThread..."
>
> def run(self):
> print "Running myThread..."
> while self.running:
> time.sleep(1)
> self.vec.append(self.dg.next())
> print "Splat"
>
> def getVec(self):
> return self.vec
>
> def stop(self):
> self.running = False
>
> def __init__(self):
> self.theThread = self.myThread()
> self.threadRunning = True
> print "initializing myThing..."
> self.theThread.start()
>
> def __del__(self):
> self.theThread.stop()
>
> def getVec(self):
> #print self.theThread.vec[:]
> return self.theThread.vec[:]
>
>
> class ApplicationWindow(QtGui.QMainWindow):
> """ The main window of the application
> """
>
> def __init__(self):
> QtGui.QMainWindow.__init__(self)
> self.setAttribute(QtCore.Qt.WA_DeleteOnClose)
> self.setWindowTitle('Demo: dynamic matplotlib graph')
>
> self.thing1 = myThing()
> self.thing2 = myThing()
> self.starttime = int(time.time())
>
>
> self.create_menu()
> #self.create_status_bar()
> self.create_main_panel()
>
> self.redraw_timer = QtCore.QTimer(self)
> QtCore.QObject.connect(self.redraw_timer,
> QtCore.SIGNAL("timeout()"), self.on_redraw_timer)
> self.redraw_timer.start(4000)
>
>
> def create_menu(self):
> menu_file = QtGui.QMenu("&File", self)
> #menu_file.addAction(u'&Save plot', self.on_save_plot,
> # QtCore.Qt.CTRL + QtCore.Qt.Key_S)
> menu_file.addSeparator()
> menu_file.addAction(u'E&xit', self.on_exit,
> QtCore.Qt.CTRL + QtCore.Qt.Key_X)
>
> self.menuBar().addMenu(menu_file)
>
> def create_main_panel(self):
> self.panel = QtGui.QFrame(self)
> self.setCentralWidget(self.panel)
>
> self.init_plot()
> self.canvas = FigCanvas(self.fig)
> self.canvas.setMinimumHeight(150)
>
> #self.toolbar = NavigationToolbar(self.canvas, None)
> self.vbox = QtGui.QVBoxLayout()
> self.vbox.addWidget(self.canvas)
>
> self.panel.setLayout(self.vbox)
> #self.vbox.Fit(self)
>
> self.unit = 20
> width, height = self.geometry().width(), self.geometry().height()
> self.show()
>
> def init_plot(self):
> self.dpi = 100
> self.fig = Figure((5.0, 3.0), dpi=self.dpi)
>
> self.axes = self.fig.add_subplot(111, navigate=False)
> self.axes.set_axis_bgcolor('black')
>
> self.axes.set_title('Very important random data', size=10)
> self.axes.set_xlabel('Time flies like an arrow',size=10)
> self.axes.set_ylabel('Random is just random',size=10)
>
> pylab.setp(self.axes.get_xticklabels(), fontsize=8)
> pylab.setp(self.axes.get_yticklabels(), fontsize=8)
>
> self.plot_data = self.axes.plot(
> self.thing1.getVec(),
> linewidth=0.5,
> color=(1, 1, 0),
> #marker='o',
> label="set1",
> )[0]
> print self.thing1.getVec(), "<<>>"
> self.plot_data2 = self.axes.plot(
> self.thing2.getVec(),
> linewidth=1,
> dashes=[.2, .4],
> color=(0, 1, 1),
> label="set2",
> )[0]
>
>
> def draw_plot(self):
> """ Redraws the plot
> """
> self.data = self.thing1.getVec()
> self.data2 = self.thing2.getVec()
> def do_cal(urdata):
> newdata = []
> for x in range(len(urdata)):
> urtime = x + self.starttime
> newdata.append(urtime)
> return newdata
>
> xmax = len(self.data) if len(self.data) > 50 else 50
>
> xmin = xmax - 50
>
> min1 = min(self.data)
> min2 = min(self.data2)
> theMin = min(min1, min2)
>
> ymin = round(theMin, 0) - 1
>
> max1 = max(self.data)
> max2 = max(self.data2)
> theMax = max(max1, max2)
>
> ymax = round(theMax, 0) + 1
>
> self.axes.set_xbound(lower=xmin, upper=xmax)
> self.axes.set_ybound(lower=ymin, upper=ymax)
>
> self.axes.grid(True, color='gray')
> pylab.setp(self.axes.get_xticklabels(),
> visible=True)
>
> self.plot_data.set_xdata(np.arange(len(self.data)))
> self.plot_data.set_ydata(np.array(self.data))
> self.plot_data2.set_xdata(np.arange(len(self.data2)))
> #self.plot_data2.set_xdata(np.array(newdata2))
> self.plot_data2.set_ydata(np.array(self.data2))
>
> self.canvas.draw()
>
>
> def on_redraw_timer(self):
> self.draw_plot()
>
> def on_exit(self):
> self.close()
>
> def closeEvent(self, event):
> for thing in (self.thing1, self.thing2):
> thing.theThread.stop()
> thing.theThread.join()
>
> if __name__ == '__main__':
> app = QtGui.QApplication(sys.argv)
> aw = ApplicationWindow()
> aw.show()
> sys.exit(app.exec_())
>
> #################################
> [image: 内嵌图片 1]
>
|