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
|
|
From: Dino B. <lj...@gm...> - 2014-06-26 01:02:18
|
Not directly related, but considering the similarity of the mail I've decided to just append my issue here. I'm using python 3.4 x86 in virtualenv on win7 x64 with full copy of Visual Studio 2010. This is my Exception message: Exception information: ____________________________________ C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\BIN\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -DPY_ARRAY_UNIQUE_SYMBOL=MPL_matplotlib_ft2font_ARRAY_API -DPYCXX_ISO_CPP_LIB=1 -DPYCXX_PYTHON_2TO3=1 -IC:\Users\Dino\Desktop\Virtual\lib\site-packages\numpy\core\include -I. -IC:\Users\Dino\Desktop\Virtual\include -IC:\python34\include -IC:\python34\include /Tpsrc/ft2font.cpp /Fobuild\temp.win32-3.4\Release\src/ft2font.obj ft2font.cpp C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\xlocale(323) : warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc c:\users\dino\desktop\virtual\build\matplotlib\src\ft2font.h(16) : fatal error C1083: Cannot open include file: 'ft2build.h': No such file or directory error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\BIN\\cl.exe' failed with exit status 2 ________________________________ 2014-06-26 2:52 GMT+02:00 Alan Ezust <ala...@gm...>: > Hi, I'm trying to build matplotlib (git master) on windows 7, Python 3.3, > with ms visual C++ 2010 SP1 > The error I am getting is related to how it can't find ft2build.h but > after running freetype-2.3.5-1.setup.exe, there is now a copy of it under > C:\Program Files (x86)\GnuWin32\include > How do I tell setup.py to look there for the header file? > Any other hints building this building on Windows 7 would be appreciated. > > [C:\Workspace\matplotlib]python setup.py build > ============================================================================ > Edit setup.cfg to change the build options > > BUILDING MATPLOTLIB > matplotlib: yes [1.4.x] > python: yes [3.3.5 (v3.3.5:62cf4e77f785, Mar 9 2014, > 10:35:05) [MSC v.1600 64 bit (AMD64)]] > platform: yes [win32] > > REQUIRED DEPENDENCIES AND EXTENSIONS > numpy: yes [version 1.8.1] > six: yes [using six version 1.7.2] > dateutil: yes [using dateutil version 2.2] > tornado: yes [tornado was not found. It is required for the > WebAgg backend. pip/easy_install may attempt to > install it after matplotlib.] > pyparsing: yes [using pyparsing version 2.0.2] > pycxx: yes [Official versions of PyCXX are not compatible > with Python 3.x. Using local copy] > libagg: yes [pkg-config information for 'libagg' could not > be found. Using local copy.] > freetype: yes [Unknown version] > png: yes [pkg-config information for 'libpng' could not > be found. Using unknown version.] > qhull: yes [pkg-config information for 'qhull' could not be > found. Using local copy.] > > OPTIONAL SUBPACKAGES > sample_data: yes [installing] > toolkits: yes [installing] > tests: yes [nose 0.11.1 or later is required to run the > matplotlib test suite. pip/easy_install may attempt > to install it after matplotlib. / using > unittest.mock] > > OPTIONAL BACKEND EXTENSIONS > macosx: no [Mac OS-X only] > qt5agg: yes [installing, Qt: 5.2.1, PyQt: 5.2.1] > qt4agg: no [PyQt4 not found] > pyside: no [PySide not found] > gtk3agg: no [gtk3agg backend does not work on Python 3] > gtk3cairo: no [Requires cairocffi or pycairo to be installed.] > gtkagg: no [Requires pygtk] > tkagg: no [The C/C++ header for Tk (tk.h) could not be > found. You may need to install the development > package.] > wxagg: no [requires wxPython] > gtk: no [Requires pygtk] > agg: yes [installing] > cairo: no [cairocffi or pycairo not found] > windowing: yes [installing, installing] > > OPTIONAL LATEX DEPENDENCIES > dvipng: no > ghostscript: no > latex: no > pdftops: no > > running build > running build_py > copying lib\matplotlib\mpl-data\matplotlibrc -> > build\lib.win-amd64-3.3\matplotlib\mpl-data > running build_ext > building 'matplotlib.ft2font' extension > C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\Bin\cl.exe /c /nologo > /Ox /MD /W3 /GS- /DNDEBUG -DPY_ARRAY_UN > IQUE_SYMBOL=MPL_matplotlib_ft2font_ARRAY_API -DPYCXX_ISO_CPP_LIB=1 > -DPYCXX_PYTHON_2TO3=1 -IC:\Python33\lib\site-pack > ages\numpy\core\include -I. -Iextern -IC:\Python33\include > -IC:\Python33\include /Tpsrc/ft2font.cpp /Fobuild\temp.wi > n-amd64-3.3\Release\src/ft2font.obj > ft2font.cpp > C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\xlocale(323) > : warning C4530: C++ exception handler u > sed, but unwind semantics are not enabled. Specify /EHsc > c:\users\r4hr-dev\workspace\matplotlib\src\ft2font.h(16) : fatal error > C1083: Cannot open include file: 'ft2build.h' > : No such file or directory > error: command '"C:\Program Files (x86)\Microsoft Visual Studio > 10.0\VC\Bin\cl.exe"' failed with exit status 2 > > > ------------------------------------------------------------------------------ > Open source business process management suite built on Java and Eclipse > Turn processes into business applications with Bonita BPM Community Edition > Quickly connect people, data, and systems into organized workflows > Winner of BOSSIE, CODIE, OW2 and Gartner awards > http://p.sf.net/sfu/Bonitasoft > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > |
|
From: Alan E. <ala...@gm...> - 2014-06-26 00:52:43
|
Hi, I'm trying to build matplotlib (git master) on windows 7, Python 3.3,
with ms visual C++ 2010 SP1
The error I am getting is related to how it can't find ft2build.h but
after running freetype-2.3.5-1.setup.exe, there is now a copy of it under
C:\Program Files (x86)\GnuWin32\include
How do I tell setup.py to look there for the header file?
Any other hints building this building on Windows 7 would be appreciated.
[C:\Workspace\matplotlib]python setup.py build
============================================================================
Edit setup.cfg to change the build options
BUILDING MATPLOTLIB
matplotlib: yes [1.4.x]
python: yes [3.3.5 (v3.3.5:62cf4e77f785, Mar 9 2014,
10:35:05) [MSC v.1600 64 bit (AMD64)]]
platform: yes [win32]
REQUIRED DEPENDENCIES AND EXTENSIONS
numpy: yes [version 1.8.1]
six: yes [using six version 1.7.2]
dateutil: yes [using dateutil version 2.2]
tornado: yes [tornado was not found. It is required for the
WebAgg backend. pip/easy_install may attempt to
install it after matplotlib.]
pyparsing: yes [using pyparsing version 2.0.2]
pycxx: yes [Official versions of PyCXX are not compatible
with Python 3.x. Using local copy]
libagg: yes [pkg-config information for 'libagg' could not
be found. Using local copy.]
freetype: yes [Unknown version]
png: yes [pkg-config information for 'libpng' could not
be found. Using unknown version.]
qhull: yes [pkg-config information for 'qhull' could not be
found. Using local copy.]
OPTIONAL SUBPACKAGES
sample_data: yes [installing]
toolkits: yes [installing]
tests: yes [nose 0.11.1 or later is required to run the
matplotlib test suite. pip/easy_install may attempt
to install it after matplotlib. / using
unittest.mock]
OPTIONAL BACKEND EXTENSIONS
macosx: no [Mac OS-X only]
qt5agg: yes [installing, Qt: 5.2.1, PyQt: 5.2.1]
qt4agg: no [PyQt4 not found]
pyside: no [PySide not found]
gtk3agg: no [gtk3agg backend does not work on Python 3]
gtk3cairo: no [Requires cairocffi or pycairo to be installed.]
gtkagg: no [Requires pygtk]
tkagg: no [The C/C++ header for Tk (tk.h) could not be
found. You may need to install the development
package.]
wxagg: no [requires wxPython]
gtk: no [Requires pygtk]
agg: yes [installing]
cairo: no [cairocffi or pycairo not found]
windowing: yes [installing, installing]
OPTIONAL LATEX DEPENDENCIES
dvipng: no
ghostscript: no
latex: no
pdftops: no
running build
running build_py
copying lib\matplotlib\mpl-data\matplotlibrc ->
build\lib.win-amd64-3.3\matplotlib\mpl-data
running build_ext
building 'matplotlib.ft2font' extension
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\Bin\cl.exe /c
/nologo /Ox /MD /W3 /GS- /DNDEBUG -DPY_ARRAY_UN
IQUE_SYMBOL=MPL_matplotlib_ft2font_ARRAY_API -DPYCXX_ISO_CPP_LIB=1
-DPYCXX_PYTHON_2TO3=1 -IC:\Python33\lib\site-pack
ages\numpy\core\include -I. -Iextern -IC:\Python33\include
-IC:\Python33\include /Tpsrc/ft2font.cpp /Fobuild\temp.wi
n-amd64-3.3\Release\src/ft2font.obj
ft2font.cpp
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\xlocale(323)
: warning C4530: C++ exception handler u
sed, but unwind semantics are not enabled. Specify /EHsc
c:\users\r4hr-dev\workspace\matplotlib\src\ft2font.h(16) : fatal error
C1083: Cannot open include file: 'ft2build.h'
: No such file or directory
error: command '"C:\Program Files (x86)\Microsoft Visual Studio
10.0\VC\Bin\cl.exe"' failed with exit status 2
|
|
From: Benjamin R. <ben...@ou...> - 2014-06-25 18:24:41
|
What it means, specifically, is that one (or more) figure objects still in memory at the time of exiting the python interpretor are missing the expected canvas attribute. I see this happen in various backends from time to time. The best I can figure is that somehow, the destructor for the figure has already been called (as it should), which should eliminate its "FigureManager" instance, but for some reason, that figure manager is still around and its destructor finally tries to destroy the canvas, which is already gone. It is really an odd bug, and I am fairly certain my diagnostic isn't quite right because I never was able to make a SSCE for testing/debugging/traceback purposes. The closest I was able to get was with a preliminary version of the animation framework Ryan May and I were working on a few years back. His code was holding some extra references, while destroying other objects... it was weird. Sorry, I don't have any solutions for you. Maybe someone else will. Ben Root On Wed, Jun 25, 2014 at 8:29 AM, <kei...@bt...> wrote: > I am running matplotlib 1.3.1 under Ubuntu 13 and python3. > Everything works fine, but I get this message every time: > > Error in atexit._run_exitfuncs: > AttributeError: 'FigureManagerGTK3Cairo' object has no attribute 'canvas' > > What does it mean, and how do I stop it? > > Keith > > > > ------------------------------------------------------------------------------ > Open source business process management suite built on Java and Eclipse > Turn processes into business applications with Bonita BPM Community Edition > Quickly connect people, data, and systems into organized workflows > Winner of BOSSIE, CODIE, OW2 and Gartner awards > http://p.sf.net/sfu/Bonitasoft > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > |
|
From: Benjamin R. <ben...@ou...> - 2014-06-25 13:30:46
|
It is because the polar projection expects theta to be in radians, not degrees. This is a somewhat common mistake as the default labelling of a polar plot is in degrees, and so it tends to confuse new users. Also, don't forget that your radar data is (most likely) describing "bearing" (so, 0 azimuth is North rather than East). Cheers! Ben Root On Wed, Jun 25, 2014 at 9:14 AM, Alexander Borghgraef < ale...@gm...> wrote: > Hi all, > > I'm trying to plot some radar data I'm working on, which is presented as > a 2048x1440 2D array of ints. This means 2048 azimuth angle values between > 0° and 360°, and 1440 range increments. Array values represent signal > return in that angle/range coordinate. Due to hardware problems, some angle > ranges are missing, there the signal value is zero in the grid. > The obvious way of plotting this would be a polar grid, so I used a > pcolormesh, like this: > > > > > * import numpy as np import matplotlib.pyplot as plt * > > * plt.ion()* > > > > > * fig = plt.figure() ax = fig.add_subplot(111, projection='polar') > theta,rad = np.meshgrid(np.arange(0., 360., 360./scan.shape[0]), > np.arange(scan.shape[1])) ax.pcolormesh(theta, rad, scan.T) plt.draw()* > > I transposed scan because theta and rad are 1440x2048 arrays, where scan > is a 2048x1440 array. > The resulting image seemed ok, but there were no gaps, which I knew were > there, so I ran the same code without the 'polar' option, and put them side > to side. The result is this: > > > In the rectangular plot, there is a gap between around 120° to 160°, > which should be an empty wedge in the polar plot, but it isn't there. Same > for the obvious echos at long range between 0° and 50°. OTOH the plot seems > quite right, with the gating gap around the radar station in the center and > the stronger echos at short range. > So I'm a bit baffled as to why this doesn't work the way it should. Does > anyone here have an explanation? > > -- > Alex Borghgraef > > > ------------------------------------------------------------------------------ > Open source business process management suite built on Java and Eclipse > Turn processes into business applications with Bonita BPM Community Edition > Quickly connect people, data, and systems into organized workflows > Winner of BOSSIE, CODIE, OW2 and Gartner awards > http://p.sf.net/sfu/Bonitasoft > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > |
|
From: Alexander B. <ale...@gm...> - 2014-06-25 13:14:59
|
Hi all, I'm trying to plot some radar data I'm working on, which is presented as a 2048x1440 2D array of ints. This means 2048 azimuth angle values between 0° and 360°, and 1440 range increments. Array values represent signal return in that angle/range coordinate. Due to hardware problems, some angle ranges are missing, there the signal value is zero in the grid. The obvious way of plotting this would be a polar grid, so I used a pcolormesh, like this: * import numpy as np import matplotlib.pyplot as plt * * plt.ion()* * fig = plt.figure() ax = fig.add_subplot(111, projection='polar') theta,rad = np.meshgrid(np.arange(0., 360., 360./scan.shape[0]), np.arange(scan.shape[1])) ax.pcolormesh(theta, rad, scan.T) plt.draw()* I transposed scan because theta and rad are 1440x2048 arrays, where scan is a 2048x1440 array. The resulting image seemed ok, but there were no gaps, which I knew were there, so I ran the same code without the 'polar' option, and put them side to side. The result is this: In the rectangular plot, there is a gap between around 120° to 160°, which should be an empty wedge in the polar plot, but it isn't there. Same for the obvious echos at long range between 0° and 50°. OTOH the plot seems quite right, with the gating gap around the radar station in the center and the stronger echos at short range. So I'm a bit baffled as to why this doesn't work the way it should. Does anyone here have an explanation? -- Alex Borghgraef |
|
From: <kei...@bt...> - 2014-06-25 12:30:18
|
I am running matplotlib 1.3.1 under Ubuntu 13 and python3. Everything works fine, but I get this message every time: Error in atexit._run_exitfuncs: AttributeError: 'FigureManagerGTK3Cairo' object has no attribute 'canvas' What does it mean, and how do I stop it? Keith |
|
From: 不坏阿峰 <onl...@gm...> - 2014-06-23 12:56:38
|
i have read demo before. when not line not move auto, it can . but while my case is need the diagram is dynamic move, i do not know how to modify my code. i have tried many times.but failed. 2014-06-21 21:22 GMT+07:00 Eric Firing <ef...@ha...>: > 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 > > > > > > ------------------------------------------------------------------------------ > 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: 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]
>
|
|
From: Joel B. M. <jo...@ki...> - 2014-06-20 16:44:48
|
I have observed that the amount of time to draw a figure with a plot depends heavily on the number of tick marks on the axes. This appears to be a major driver of perceived refresh performance on interactive graphics in PySide (for example). Somewhat tangentially this makes log axes appear to perform slowly, but I think that is merely a side-effect of the fact that log axes come with minor tick marks by default. I'm working with built-from-source matplotlib as of Apr 17, 2014; I think the observations here apply to any recent matplotlib. I've published a full illustration at https://gist.github.com/jbmohler/7c5c8cca39826ea8ede7 . This small PySide application lets you enter the number of points in a scatter plot and the number of minor tick marks. You can see for yourself that increasing the number of points in the scatter plot has little impact on performance, but increasing the number of tick marks has a noticeable effect with only moderate increase. Why does this matter if you have a sane number of tick marks? It points to tick marks being simply very expensive -- on my 2 year old quad core, entirely removing tick marks results in 117 frames per second, but with 7 (major) tick marks on x & y that drops to 38 frames per second. I think 100 tick marks falls with-in "sane" (in some cases) and a graph with 100 tick marks has decidedly more lag in a gui than 10 tick marks. As mentioned above, log axes are particularly likely place to have lots of tick marks. How can I fix this? I'm not sure, but I think there are reasonable special cases that could be highly optimized. The problem seems to me to be that each tick mark is a Line2D artist and that has a marker type (in fact, I think there is no "line" shown, the tick mark is the single marker of the Line2D). In the case of uniform sized tick marks, I believe the tick marks for an axis could be all in one Line2D with each tick mark being a marker in the single Line2D. This is a huge reduction of artists which seems likely to yield a speed up in quite few places. I'd love to hear your thoughts and/or fix suggestions on this topic. Joel |
|
From: Bruno P. <bru...@gm...> - 2014-06-20 15:15:08
|
Ok! I'm getting there! I've been trying to figure out, though, how to set black - for example - for the zero values BUT interpolate also the colors linearly from black to blue in the linear region (from zero to the linear threshold). Is there a way to change the colormap like that? Thanks a lot! On 2014/06/18, 5:23 AM, Bruno Pace wrote: > Ok, so using the norm=SymLogNorm I cannot distinguish the values that > are exactly 0.0 from the really small ones, right? Would it be possible > Correct, the scale is linear for small values. to make use of the set_bad method without having to use masked arrays, > just combining the SymLogNorm and the set_bad? > No, the mask is what identifies a point as bad. If you want to distinguish zero from non-zero, no matter how small, then this is the way to do it. zm = np.ma.masked_equal(z, 0, copy=False) Now you have a masked array where the points that are exactly zero are masked. The bad color won't show up on the colorbar, however. There is no suitable place for it. It can show only the range from vmin to vmax, and a "set_over" color for values greater than vmax, and a "set_under" color for values less than vmin. Eric |
|
From: Chris B. <bea...@ha...> - 2014-06-20 13:42:17
|
Hey Tom, It looks like the only backend-agnostic file save function is save_figure() (a toolbar method), which conflates choosing a filename and doing the actual saving. The backend-specific code to choose a filename via a dialog isn't uniform: Qt4: matplotlib.backends.backend_qt4._getSaveFileName MacOS matplotlib.backends.backend_osx._macosx.choose_save_file Wx: A bunch of code in matplotlib.backends.backend_wx.save_figure TkAgg: Tkinter.FileDialog GtkAgg: get_filechooser().get_filename_from_user() It looks like, at a minimum, you would have to write your own wrapper code to make a backend-agnostic interface for choosing a filename. Of course, if you did that, it would also be nice to refactor that into MPL itself... :) chris On Fri, Jun 20, 2014 at 8:22 AM, Thomas Robitaille < tho...@gm...> wrote: > Hi everyone, > > I'm developing a simple GUI tool in Matplotlib that relies on the > event framework to handle buttons/sliders. I am trying to avoid using > a GUI toolkit directly to ensure maximum compatibility for users. > > One thing I would like is to be able to have a 'save' button that will > open up a standard 'save file' dialog window (but not necessarily the > plot itself). Matplotlib already has 'save file' GUI dialogs for the > different backends, so I was wondering whether there is an easy and > abstract way of asking matplotlib to open a 'save file' dialog and > capturing the output? Or is this all handled separately in the > different backends? > > Thanks! > Tom > > > ------------------------------------------------------------------------------ > 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 > > -- > ************************************* > Chris Beaumont > Senior Software Engineer > Harvard Center for Astrophysics > 60 Garden Street, MS 42 > Cambridge, MA 02138 > chrisbeaumont.org > ************************************* > |
|
From: Thomas R. <tho...@gm...> - 2014-06-20 12:23:06
|
Hi everyone, I'm developing a simple GUI tool in Matplotlib that relies on the event framework to handle buttons/sliders. I am trying to avoid using a GUI toolkit directly to ensure maximum compatibility for users. One thing I would like is to be able to have a 'save' button that will open up a standard 'save file' dialog window (but not necessarily the plot itself). Matplotlib already has 'save file' GUI dialogs for the different backends, so I was wondering whether there is an easy and abstract way of asking matplotlib to open a 'save file' dialog and capturing the output? Or is this all handled separately in the different backends? Thanks! Tom |
|
From: Eric F. <ef...@ha...> - 2014-06-19 19:47:59
|
On 2014/06/18, 5:23 AM, Bruno Pace wrote: > Ok, so using the norm=SymLogNorm I cannot distinguish the values that > are exactly 0.0 from the really small ones, right? Would it be possible Correct, the scale is linear for small values. > to make use of the set_bad method without having to use masked arrays, > just combining the SymLogNorm and the set_bad? No, the mask is what identifies a point as bad. If you want to distinguish zero from non-zero, no matter how small, then this is the way to do it. zm = np.ma.masked_equal(z, 0, copy=False) Now you have a masked array where the points that are exactly zero are masked. The bad color won't show up on the colorbar, however. There is no suitable place for it. It can show only the range from vmin to vmax, and a "set_over" color for values greater than vmax, and a "set_under" color for values less than vmin. Eric |
|
From: Neal B. <ndb...@gm...> - 2014-06-19 15:31:14
|
/usr/lib64/python2.7/site-packages/matplotlib/tight_layout.py:225: UserWarning:
tight_layout : falling back to Agg renderer
warnings.warn("tight_layout : falling back to Agg renderer")
Traceback (most recent call last):
File "./plot_stuff2.py", line 10, in <module>
plt.tight_layout()
File "/usr/lib64/python2.7/site-packages/matplotlib/pyplot.py", line 1255, in
tight_layout
fig.tight_layout(pad=pad, h_pad=h_pad, w_pad=w_pad, rect=rect)
File "/usr/lib64/python2.7/site-packages/matplotlib/figure.py", line 1605, in
tight_layout
rect=rect)
File "/usr/lib64/python2.7/site-packages/matplotlib/tight_layout.py", line
325, in get_tight_layout_figure
max_nrows = max(nrows_list)
ValueError: max() arg is an empty sequence
The plotting script is quite long and complex, so I won't post it, but it
begins:
#!/usr/bin/python
import matplotlib as mpl
mpl.use ('pdf')
import matplotlib.pyplot as plt
plt.tight_layout()
It produces multipage-pdf using
from matplotlib.backends.backend_pdf import PdfPages
It works without plt.tight_layout(). Any clues what I did wrong here?
|
|
From: Slavin, J. <js...@cf...> - 2014-06-19 12:37:48
|
So do you want to find the particular row or column to plot interactively? For that you should look at "Event handling and picking" in the matplotlib docs (http://matplotlib.org/users/event_handling.html). It shows there how to return the values of the location of mouse click events. Once you have either the x or y value then you could find the values in your array that correspond to that and plot them. Or is how to do the latter your question? For more involved data exploration, you might want to look into glue ( www.glueviz.org). Jon On Thu, Jun 19, 2014 at 4:27 AM, < mat...@li...> wrote: > From: dydy2014 <dya...@gm...> > To: mat...@li... > Cc: > Date: Wed, 18 Jun 2014 17:56:21 -0700 (PDT) > Subject: Re: [Matplotlib-users] Pick a particular data from array > Thank you Paul for your comment, but what I need not just put a line in the > contour. > I want to pick value along the red line, so which the data that placed on > the red line. > Then I will plot it in the other type of plot. > -- ________________________________________________________ Jonathan D. Slavin Harvard-Smithsonian CfA js...@cf... 60 Garden Street, MS 83 phone: (617) 496-7981 Cambridge, MA 02138-1516 fax: (617) 496-7577 USA ________________________________________________________ |
|
From: 不坏阿峰 <onl...@gm...> - 2014-06-19 12:36:21
|
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]
|
|
From: 不坏阿峰 <onl...@gm...> - 2014-06-19 12:17:49
|
thanksfor ur reply. after i send this mail . i have trie annotate, and
make it works.
if have good style, hope all of u can share it.
############
for i in range(len(ls)):
circle_ls.append(pie(ax, ls[i], radius=r_len-width*i,
pctdistance=1-width/2, **kwargs))
ax.annotate('test0' + str(i), xy=(0.1,0.5-i *
0.2),xytext=(0.6,0.5-i *
0.2),arrowprops=dict(arrowstyle="->",connectionstyle="arc3"))
############
[image: 内嵌图片 1]
2014-06-19 18:30 GMT+07:00 Mike Kaufman <mc...@gm...>:
> use annotate()
>
>
> http://matplotlib.org/users/annotations_guide.html#plotting-guide-annotation
>
> M
>
> On 6/19/14, 12:27 AM, 不坏阿峰 wrote:
> > thanks to Joe Kington
> > <https://plus.google.com/u/0/115087865729901776991?prsrc=4>‘s help, i
> > got this pie donuts
> > i have modified code to generate pie base one the Num of list.
> > but i do not know how to draw the text label like below, i need label
> > inform of each pie . pls give me some guide.
> > thanks a lot
> > 内嵌图片 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: Mike K. <mc...@gm...> - 2014-06-19 11:30:31
|
use annotate() http://matplotlib.org/users/annotations_guide.html#plotting-guide-annotation M On 6/19/14, 12:27 AM, 不坏阿峰 wrote: > thanks to Joe Kington > <https://plus.google.com/u/0/115087865729901776991?prsrc=4>‘s help, i > got this pie donuts > i have modified code to generate pie base one the Num of list. > but i do not know how to draw the text label like below, i need label > inform of each pie . pls give me some guide. > thanks a lot > 内嵌图片 1 > |
|
From: Oliver <oli...@gm...> - 2014-06-19 08:17:53
|
Just to clarify, do you actually want to be able to "pick" it, so by selecting in interactively (and probably manually, i.e. with the mouse) or are you only interested in displaying the "data underneath the line". The second is straightforward: just plot in a new axes the relevant row of your 2D data. The former requires you to add events to your figure so that you can pick values interactively. The matplotlib example [pick_event_demo][1] shows you how it's done. I recomment studying it and then asking again if it doesn't work. 1: http://matplotlib.org/examples/event_handling/pick_event_demo.html 2014-06-19 2:56 GMT+02:00 dydy2014 <dya...@gm...>: > Thank you Paul for your comment, but what I need not just put a line in the > contour. > I want to pick value along the red line, so which the data that placed on > the red line. > Then I will plot it in the other type of plot. > > > > > > > > -- > View this message in context: > http://matplotlib.1069221.n5.nabble.com/Pick-a-particular-data-from-array-tp43532p43545.html > Sent from the matplotlib - users mailing list archive at Nabble.com. > > > ------------------------------------------------------------------------------ > 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-19 04:27:43
|
thanks to Joe Kington <https://plus.google.com/u/0/115087865729901776991?prsrc=4>‘s help, i got this pie donuts i have modified code to generate pie base one the Num of list. but i do not know how to draw the text label like below, i need label inform of each pie . pls give me some guide. thanks a lot [image: 内嵌图片 1] ################################# from __future__ import unicode_literals import matplotlib.pyplot as plt import numpy as np import sys # os, random from PyQt4 import QtGui, QtCore #from numpy import arange, sin, pi from matplotlib import font_manager as fm from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas #from matplotlib.figure import Figure from mychart_ui import Ui_Form class MyMplCanvas(FigureCanvas): """Ultimately, this is a QWidget (as well as a FigureCanvasAgg, etc.).""" def __init__(self, parent=None, width=5, height=4, dpi=100): #fig = Figure(figsize=(width, height), dpi=dpi) # self.axes = fig.add_subplot(111) # We want the axes cleared every time plot() is called #self.axes.hold(False) plt.rcParams['font.size'] = 9 plt.rcParams['font.weight'] = 'normal' self.fig, self.axes = plt.subplots() self.compute_initial_figure() # FigureCanvas.__init__(self, self.fig) self.setParent(parent) FigureCanvas.setSizePolicy(self, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) FigureCanvas.updateGeometry(self) def compute_initial_figure(self): pass class MyStaticMplCanvas(MyMplCanvas): """Simple canvas with a sine plot.""" def compute_initial_figure(self): #fig, ax = plt.subplots() #ax.axis = ('equal') data = [[96, 124],[33, 64],[55, 96]] header = ['Hardware', 'Software'] def pie_plot(myfig,myaxes,data): fig = myfig ax = myaxes ax.set_position([-0.12, 0.4, 0.6, 0.6]) ax.axis('equal') ls = data r_len = 0.6 width = r_len/(len(ls)+1) print width kwargs = dict(colors=['#66FF66', '#9999FF', '#FF9999'], startangle=90) proptease = fm.FontProperties() proptease.set_size('xx-small') circle_ls = [] for i in range(len(ls)): print i circle_ls.append(pie(ax, ls[i], radius=r_len-width*i, pctdistance=1-width/2, **kwargs)) # outside = pie(ax, ls[0], radius=r_len, pctdistance=1-width/2, **kwargs) # middle = pie(ax,ls[1] , radius=r_len-width, # pctdistance=1-width/2, **kwargs) # middle2 = pie(ax,ls[1] , radius=r_len-width*2, # pctdistance=1-width/2, **kwargs) # inside = pie(ax,ls[2] , radius=r_len-width*3, # pctdistance=1-width/2, **kwargs) plt.setp(circle_ls, width=width, edgecolor='white') ax.legend(circle_ls[0][::-1], header, frameon=False) pie_plot(self.fig,self.axes,data) kwargs = dict(size=13, color='white', va='center', fontweight='bold') # ax.text(0, 0, 'Year 2005', ha='center', # bbox=dict(boxstyle='round', facecolor='blue', edgecolor='none'), # **kwargs) # ax.annotate('Year 2006', (0, 0), xytext=(np.radians(-45), 1.1), # bbox=dict(boxstyle='round', facecolor='green', edgecolor='none'), # textcoords='polar', ha='left', **kwargs) #ax.axes.plot() def pie(ax, values, **kwargs): total = sum(values) def formatter(pct): return '{:0.0f}\n{:0.1f}%'.format(pct*total/100,pct) wedges, _, labels = ax.pie(values, autopct=formatter, **kwargs) return wedges #plt.show() class myWidget(QtGui.QWidget, Ui_Form): def __init__(self,parent=None): QtGui.QWidget.__init__(self, parent) self.setupUi(self) self.pushButton.clicked.connect(self.draw) def draw(self): print '=' sc = MyStaticMplCanvas(self.matwidget, width=2, height=3, dpi=100) sc.show() qApp = QtGui.QApplication(sys.argv) # aw = ApplicationWindow() # aw.setWindowTitle("%s" % progname) aw = myWidget() aw.show() sys.exit(qApp.exec_()) #################################### |
|
From: dydy2014 <dya...@gm...> - 2014-06-19 00:56:28
|
Thank you Paul for your comment, but what I need not just put a line in the contour. I want to pick value along the red line, so which the data that placed on the red line. Then I will plot it in the other type of plot. -- View this message in context: http://matplotlib.1069221.n5.nabble.com/Pick-a-particular-data-from-array-tp43532p43545.html Sent from the matplotlib - users mailing list archive at Nabble.com. |
|
From: Bruno P. <bru...@gm...> - 2014-06-18 15:23:13
|
Ok, so using the norm=SymLogNorm I cannot distinguish the values that are exactly 0.0 from the really small ones, right? Would it be possible to make use of the set_bad method without having to use masked arrays, just combining the SymLogNorm and the set_bad? Thanks! 2014-06-17 21:20 GMT+02:00 Eric Firing <ef...@ha...>: > On 2014/06/17, 8:59 AM, Bruno Pace wrote: > > Hi all, > > > > I'm trying to use imshow to plot some values which fall on the interval > > [0,1]. I need to > > use a logscale to emphasize the scales of the data. The solution I found > > checking some discussions was like this > > > > plt.imshow(X, interpolation='none', norm=matplotlib.colors.LogNorm()) > > > > However, I notice that the way these colors are assigned are not always > > the same (although my data always contains the minimum value 0.0 and > > the maximum 1.0). I need to have a coherent color scale to indicate > > the real values. Is it easier to do the color code myself? What is the > > proper way of tackling this problem?? > > Use the vmin and vmax kwargs to LogNorm, remembering that vmin must be > greater than zero for a log scale. > > Eric > > > > > It's pretty much the same problem described here, but with a logscale... > > > > > http://stackoverflow.com/questions/7875688/how-can-i-create-a-standard-colorbar-for-a-series-of-plots-in-python > > > > > > Thank you very much! > > > > Bruno > > > > > > > ------------------------------------------------------------------------------ > > 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 > > > > > > ------------------------------------------------------------------------------ > 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: Bruno P. <bru...@gm...> - 2014-06-18 14:14:35
|
Hey all, I am trying to produce an animation from several images generated with imshow from a sequence of arrays in time, I have done that in several ways. However, my animations consist of several frames (on the order of 10000 frames) and thus the simulation crashes when it's too large. The solution I found was writing the png files and then animating. It is very time and memory consuming, though, and I have the impression it is not the best solution to tackle this problem. What is the best practice to deal with this problem? Thanks! Bruno P.S.: I'm using Ipython, would it change running from a terminal instead of running it from the shell? |
|
From: Eric F. <ef...@ha...> - 2014-06-17 19:20:48
|
On 2014/06/17, 8:59 AM, Bruno Pace wrote: > Hi all, > > I'm trying to use imshow to plot some values which fall on the interval > [0,1]. I need to > use a logscale to emphasize the scales of the data. The solution I found > checking some discussions was like this > > plt.imshow(X, interpolation='none', norm=matplotlib.colors.LogNorm()) > > However, I notice that the way these colors are assigned are not always > the same (although my data always contains the minimum value 0.0 and > the maximum 1.0). I need to have a coherent color scale to indicate > the real values. Is it easier to do the color code myself? What is the > proper way of tackling this problem?? Use the vmin and vmax kwargs to LogNorm, remembering that vmin must be greater than zero for a log scale. Eric > > It's pretty much the same problem described here, but with a logscale... > > http://stackoverflow.com/questions/7875688/how-can-i-create-a-standard-colorbar-for-a-series-of-plots-in-python > > > Thank you very much! > > Bruno > > > ------------------------------------------------------------------------------ > 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 > |