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
(10) |
2
(6) |
3
(1) |
4
(4) |
5
(11) |
6
(19) |
7
(18) |
8
(7) |
9
(9) |
10
(4) |
11
(3) |
12
(5) |
13
(19) |
14
(13) |
15
(21) |
16
(4) |
17
|
18
(5) |
19
(9) |
20
(13) |
21
(7) |
22
|
23
(1) |
24
(3) |
25
|
26
(3) |
27
(1) |
28
(2) |
29
(6) |
30
(5) |
31
|
On Wednesday, December 14, 2011, Keld Lundgaard <kel...@gm...> wrote: > > Hi > > How do I get the information about the endpoint of a text element? > > Example: > > import matplotlib.pylab as plt > text = plt.text(0.5,0.5,'hi') > plt.show() > > In the dataTrans coordinates, where does the text string ends? > > > I have spent some time now trying to solve this, seemingly simple problem, > so I appreciate any help a lot! > > > Thanks in advance! > > / Keld It is actually a very difficult thing to do, and is why mpl does not provide a mechanism to find out until after rendering. The problem is that -- in the general case -- it is not possible to know ahead of time how much space some text will take up for an arbitrary font, style and size. You can have the figure get rendered, and then you can query the text's bounding box, if I understand correctly. Maybe the code for tight_layout() might show how it does this. Ben Root
Hi How do I get the information about the endpoint of a text element? Example: import matplotlib.pylab as plt text = plt.text(0.5,0.5,'hi') plt.show() In the dataTrans coordinates, where does the text string ends? I have spent some time now trying to solve this, seemingly simple problem, so I appreciate any help a lot! Thanks in advance! / Keld -- View this message in context: http://old.nabble.com/Endpoint-of-a-text-string-in-a-plot--tp32977548p32977548.html Sent from the matplotlib - users mailing list archive at Nabble.com.
I sadly, have to include pie charts in a presentation/document I am putting together. I have 6 categories, but 4 of them are a very small fraction of the total... so the base pie chart even with exploded sections looks terrible. Also, I need to display the % values and category labels. Using autopct and labels arguments makes for lots of overlapping mess. maybe they can render outside of the plot area if the slice is too small? Its terribly taboo I know, but can it look cool and 3D too... my boss would love me if it did! Any suggestions or places to find a gorgeous pie chart, let me know... Thanks for your help! Justin
On Wed, Dec 14, 2011 at 6:35 AM, Michael Droettboom <md...@st...> wrote: > You'll want to set the rcParam "pdf.fonttype" to 42 to embed the entire > TTF file in the PDF file, allowing for editing text as text. > > Mike > > > Just to be clear, are we talking about how we now save pdf/eps files with individual characters rather than entire strings? Is setting pdf.fonttype to 42 going to change that behavior? Ben Root
On 12/14/2011 12:31 PM, David Hoese wrote: > Does anyone know if using the blit method from FigureCanvasQTAgg is not > fully supported? I'm having a problem where I'm animating a plot using > the blit method and I click on/activate the window the background of the > figure disappears (axes and line stay visible). I'm not sure if this is > just me (Mac OS X Lion, Qt4 4.8.6, Matplotlib 1.1.0), but the following > code reproduces the error: > David, It works for me on linux with mpl from git. I haven't tried to figure it out, but it is conceivable that the problem you are seeing was fixed with this: commit b624546ae60dc5878e75a32f41a160d383548b8f Author: Eric Firing <ef...@ha...> Date: Tue Oct 18 08:06:21 2011 -1000 backend_qt4agg: draw() immediately calls FigureCanvasAgg.draw() This is the latest in a series of modifications to the Qt4Agg drawing strategy going back several years. It simplifies the code and should solve the problem introduced in 6938b0025; that is, delaying the Agg draw operation until the paintEvent breaks code expecting that draw operation to have occurred immediately. The problem was reported here: http://sourceforge.net/mailarchive/message.php?msg_id=28245744 Eric > ### > from PyQt4 import QtGui,QtCore > from matplotlib.figure import Figure > from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg > from time import sleep > > app = QtGui.QApplication([" "]) > f = Figure() > c = FigureCanvasQTAgg(f) > a = f.add_subplot(111) > a.set_title("A Title") > bbox = c.copy_from_bbox(a.bbox) > lines = a.plot([1,2,3],[1,2,3]) > c.draw() > c.show() > > wait = raw_input("Press a key to continue...") > > def update(i): > a.lines[0].set_ydata([i,1,i]) > print a.bbox.bounds > c.restore_region(bbox, bbox=a.bbox) > a.draw_artist(a.lines[0]) > c.blit(a.bbox) > > sleep(1) > app.processEvents() > > for i in range(20): > update(i) > > wait = raw_input("Press a key to continue...") > ### > > To see the problem, run the code, watch the plot to make sure its > updating properly, then click on the window to put it in focus/activate > it. I'm hoping that I'm just doing something stupid and its an easy > fix. It seems to work until I click on the window (in Mac OS X Lion > Terminal the window is opened in the background and the Terminal window > stays in focus). Thanks for any help. > > -Dave > > > ------------------------------------------------------------------------------ > Cloud Computing - Latest Buzzword or a Glimpse of the Future? > This paper surveys cloud computing today: What are the benefits? > Why are businesses embracing it? What are its payoffs and pitfalls? > http://www.accelacomm.com/jaw/sdnl/114/51425149/ > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Does anyone know if using the blit method from FigureCanvasQTAgg is not fully supported? I'm having a problem where I'm animating a plot using the blit method and I click on/activate the window the background of the figure disappears (axes and line stay visible). I'm not sure if this is just me (Mac OS X Lion, Qt4 4.8.6, Matplotlib 1.1.0), but the following code reproduces the error: ### from PyQt4 import QtGui,QtCore from matplotlib.figure import Figure from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg from time import sleep app = QtGui.QApplication([" "]) f = Figure() c = FigureCanvasQTAgg(f) a = f.add_subplot(111) a.set_title("A Title") bbox = c.copy_from_bbox(a.bbox) lines = a.plot([1,2,3],[1,2,3]) c.draw() c.show() wait = raw_input("Press a key to continue...") def update(i): a.lines[0].set_ydata([i,1,i]) print a.bbox.bounds c.restore_region(bbox, bbox=a.bbox) a.draw_artist(a.lines[0]) c.blit(a.bbox) sleep(1) app.processEvents() for i in range(20): update(i) wait = raw_input("Press a key to continue...") ### To see the problem, run the code, watch the plot to make sure its updating properly, then click on the window to put it in focus/activate it. I'm hoping that I'm just doing something stupid and its an easy fix. It seems to work until I click on the window (in Mac OS X Lion Terminal the window is opened in the background and the Terminal window stays in focus). Thanks for any help. -Dave
Hi Latex rendering looks OK here. > In [9]: matplotlib.__version__ > Out[9]: '1.0.0' However, synaptic tells me: 1.0.1-rc1-1ubuntu5. System Ubuntu 10.10 with ppa (http://ppa.launchpad.net/bgamari/matplotlib-unofficial/ubuntu) for matplotlib 1.0.1. Best, Peter Am 07.12.2011 23:06, schrieb Alejandro Weinstein: > Hi: > > I am getting incorrect renderings when using \hat{x} or \vec{x}. The > following code > > ##################################################### > import matplotlib.pylab as plt > > plt.axes([0.1, 0.15, 0.8, 0.75]) > plt.plot(range(10)) > > plt.xlabel(r'$\hat{y}$ $\vec{x}$ $x^2 + y^2$', fontsize=20) > plt.show() > ##################################################### > > produce the attached plot. Note that the "hat" and the "arrow" are in > the wrong place. The other Latex part looks OK. > > I am running version 1.2.x (built from commit > 11e528425e230a3e23d04202aea23d88d40d9c4c) and Ubuntu 11.10. > > Any ideas about how to solve the problem? > > Alejandro. >
I don't know what you mean by "ApplicationWindow", is that a class or just a name for the main GUI window. I also don't really know what calling the graphical application means, but I'm sure the book can help you more than I can. Again, good luck. -Dave On 12/14/11 10:17 AM, Fabien Lafont wrote: > Thanks David, I start to read the Mark summerfield' book about PyQt > programming. > > In fact I realized I don't need multi-threading because I can remove > the Timer and just need to call the graphical application from the > while loop. > > How can I call the "ApplicationWindow" class from my while loop? I'll > try to read a bit more about PyQt to understand how it works :) > > thanks again! > > Fabien > > 2011年12月14日 David Hoese<dh...@gm...>: >> I'm not sure how experienced you are with multithreaded programs, but here >> is some sample code (I mentioned it can get complicated). I suggest you >> research Qt4 QThreads and also Qt4 Signals and slots to better understand >> the code below. It is a working sample so you should be able to run it in a >> terminal and notice that the GUI is responsive and that you have messages >> being printed out on the terminal. The code I provided below is more >> complicated than you may need for a proof-of-concept kind of program, but if >> you will be communicating with physical devices I suggest something like >> this. I am by no means and expert, but I have been doing something similar >> to what you are doing. I also suggest maybe separating the device >> communication into another module/class, especially if others are going to >> (re)use your code. >> >> Good Luck, >> Dave >> >> P.S. There are a lot of Qt4/PyQt4 threading examples online, but not all of >> them correct. What I posted below is what I have found to be considered >> "correct" by most people. >> >> ################# >> ### Sample Code ### >> ################# >> >> import time >> from PyQt4 import QtGui,QtCore >> >> class MyWindow(QtGui.QWidget): >> def __init__(self): >> QtGui.QWidget.__init__(self) >> >> # Sample GUI elements to test responsiveness >> the_choices = ["item"]*20 >> self.choices = QtGui.QComboBox() >> self.choices.addItems(the_choices) >> self.layout = QtGui.QVBoxLayout(self) >> self.layout.addWidget(self.choices) >> self.setLayout(self.layout) >> >> def handle_new_data(self): >> # This is where you could redraw any matplotlib plots >> # Maybe send data through the signal/slot connection >> print "Updating data" >> >> class MyInstrument(QtCore.QObject): >> signal_new_data = QtCore.pyqtSignal(name="signal_new_data") >> signal_closing = QtCore.pyqtSignal(name="signal_closing") >> def run(self): >> self._timer = QtCore.QTimer() >> self._timer.timeout.connect(self._run) >> self._timer.start(0) >> >> def _run(self): >> time.sleep(1) >> print "Running the instrument function" >> time.sleep(1) >> self.signal_new_data.emit() >> >> def close(self): >> print "Closing instrument thread" >> self._timer.stop() >> # Redundant timer stop >> self._timer.timeout.disconnect() >> self.signal_closing.emit() >> >> if __name__ == "__main__": >> app = QtGui.QApplication([" "]) >> w = MyWindow() >> w.show() >> instrument = MyInstrument() >> instrument_thread = QtCore.QThread() >> instrument.moveToThread(instrument_thread) >> >> instrument_thread.started.connect(instrument.run) >> instrument.signal_new_data.connect(w.handle_new_data) >> >> # Make the close function run in the main thread so you can "interrupt" >> the sleeps >> app.lastWindowClosed.connect(instrument.close, >> QtCore.Qt.DirectConnection) >> # You could also call quit "manually" after exec_() returns >> instrument.signal_closing.connect(instrument_thread.quit) >> >> instrument_thread.start() >> app.exec_() >> #instrument_thread.quit() >> >> print "Waiting for instrument thread..." >> instrument_thread.wait() >> print "SUCCESS" >> >> ###################### >> ### End of Sample Code ### >> ###################### >> >> >> On 12/14/11 3:51 AM, Fabien Lafont wrote: >>> I prefer to use the multi-thread method beacause it's easier for me >>> and my colaborators to have the entire acquisition process at the same >>> place. Until then I use a simple one but I hope to use a more complex >>> one in few weeks ( put different voltages on different devices then >>> measure many voltages or current). If I use the "domino" technique >>> (call the next operation by the end of the previous) it can be complex >>> to read and to edit. Thank you very much anyway! >>> >>> How can I write a multi-thread process? I've just tried to add >>> qApp.processEvents() at the end of my while loop but it doesn't change >>> anything... >>> >>> Thanks again, >>> >>> Fabien >>> >>> 2011年12月13日 David Hoese<dh...@gm...>: >>>> Yeah I didn't think about suggesting that, but I think it might get >>>> complicated. I think he would have to start a one shot timer to call a >>>> function to set the voltage. Then that function would also start another >>>> one shot timer to call another function that would read from the sample. >>>> That function then would start a one shot timer to call the first >>>> function >>>> again. This way he can be sure that things are called in order and that >>>> timing is consistent, just in case the GUI gets complicated or something >>>> makes the event loop slow down. >>>> >>>> He could also use multiple threads. Whatever works for Fabien I guess. >>>> >>>> -Dave >>>> >>>> On 12/13/11 1:00 PM, mat...@li... >>>> wrote: >>>>> From: "Drain, Theodore R (343P)"<the...@jp...> >>>>> >>>>> Subject: Re: [Matplotlib-users] [ploting data] Live data >>>>> >>>>> Perhaps I'm missing something, but why not use QTimer? You can't really >>>>> every call sleep in a single threaded gui (for reasons you've >>>>> encountered). >>>>> If you need to poll something, create a QTimer for 2 seconds and have >>>>> it >>>>> call a measurement function to update the data. You shouldn't need any >>>>> processEvents calls or sleep. >>>>
Thanks David, I start to read the Mark summerfield' book about PyQt programming. In fact I realized I don't need multi-threading because I can remove the Timer and just need to call the graphical application from the while loop. How can I call the "ApplicationWindow" class from my while loop? I'll try to read a bit more about PyQt to understand how it works :) thanks again! Fabien 2011年12月14日 David Hoese <dh...@gm...>: > I'm not sure how experienced you are with multithreaded programs, but here > is some sample code (I mentioned it can get complicated). I suggest you > research Qt4 QThreads and also Qt4 Signals and slots to better understand > the code below. It is a working sample so you should be able to run it in a > terminal and notice that the GUI is responsive and that you have messages > being printed out on the terminal. The code I provided below is more > complicated than you may need for a proof-of-concept kind of program, but if > you will be communicating with physical devices I suggest something like > this. I am by no means and expert, but I have been doing something similar > to what you are doing. I also suggest maybe separating the device > communication into another module/class, especially if others are going to > (re)use your code. > > Good Luck, > Dave > > P.S. There are a lot of Qt4/PyQt4 threading examples online, but not all of > them correct. What I posted below is what I have found to be considered > "correct" by most people. > > ################# > ### Sample Code ### > ################# > > import time > from PyQt4 import QtGui,QtCore > > class MyWindow(QtGui.QWidget): > def __init__(self): > QtGui.QWidget.__init__(self) > > # Sample GUI elements to test responsiveness > the_choices = ["item"]*20 > self.choices = QtGui.QComboBox() > self.choices.addItems(the_choices) > self.layout = QtGui.QVBoxLayout(self) > self.layout.addWidget(self.choices) > self.setLayout(self.layout) > > def handle_new_data(self): > # This is where you could redraw any matplotlib plots > # Maybe send data through the signal/slot connection > print "Updating data" > > class MyInstrument(QtCore.QObject): > signal_new_data = QtCore.pyqtSignal(name="signal_new_data") > signal_closing = QtCore.pyqtSignal(name="signal_closing") > def run(self): > self._timer = QtCore.QTimer() > self._timer.timeout.connect(self._run) > self._timer.start(0) > > def _run(self): > time.sleep(1) > print "Running the instrument function" > time.sleep(1) > self.signal_new_data.emit() > > def close(self): > print "Closing instrument thread" > self._timer.stop() > # Redundant timer stop > self._timer.timeout.disconnect() > self.signal_closing.emit() > > if __name__ == "__main__": > app = QtGui.QApplication([" "]) > w = MyWindow() > w.show() > instrument = MyInstrument() > instrument_thread = QtCore.QThread() > instrument.moveToThread(instrument_thread) > > instrument_thread.started.connect(instrument.run) > instrument.signal_new_data.connect(w.handle_new_data) > > # Make the close function run in the main thread so you can "interrupt" > the sleeps > app.lastWindowClosed.connect(instrument.close, > QtCore.Qt.DirectConnection) > # You could also call quit "manually" after exec_() returns > instrument.signal_closing.connect(instrument_thread.quit) > > instrument_thread.start() > app.exec_() > #instrument_thread.quit() > > print "Waiting for instrument thread..." > instrument_thread.wait() > print "SUCCESS" > > ###################### > ### End of Sample Code ### > ###################### > > > On 12/14/11 3:51 AM, Fabien Lafont wrote: >> >> I prefer to use the multi-thread method beacause it's easier for me >> and my colaborators to have the entire acquisition process at the same >> place. Until then I use a simple one but I hope to use a more complex >> one in few weeks ( put different voltages on different devices then >> measure many voltages or current). If I use the "domino" technique >> (call the next operation by the end of the previous) it can be complex >> to read and to edit. Thank you very much anyway! >> >> How can I write a multi-thread process? I've just tried to add >> qApp.processEvents() at the end of my while loop but it doesn't change >> anything... >> >> Thanks again, >> >> Fabien >> >> 2011年12月13日 David Hoese<dh...@gm...>: >>> >>> Yeah I didn't think about suggesting that, but I think it might get >>> complicated. I think he would have to start a one shot timer to call a >>> function to set the voltage. Then that function would also start another >>> one shot timer to call another function that would read from the sample. >>> That function then would start a one shot timer to call the first >>> function >>> again. This way he can be sure that things are called in order and that >>> timing is consistent, just in case the GUI gets complicated or something >>> makes the event loop slow down. >>> >>> He could also use multiple threads. Whatever works for Fabien I guess. >>> >>> -Dave >>> >>> On 12/13/11 1:00 PM, mat...@li... >>> wrote: >>>> >>>> From: "Drain, Theodore R (343P)"<the...@jp...> >>>> >>>> Subject: Re: [Matplotlib-users] [ploting data] Live data >>>> >>>> Perhaps I'm missing something, but why not use QTimer? You can't really >>>> every call sleep in a single threaded gui (for reasons you've >>>> encountered). >>>> If you need to poll something, create a QTimer for 2 seconds and have >>>> it >>>> call a measurement function to update the data. You shouldn't need any >>>> processEvents calls or sleep. >>> >>> >
I'm not sure how experienced you are with multithreaded programs, but here is some sample code (I mentioned it can get complicated). I suggest you research Qt4 QThreads and also Qt4 Signals and slots to better understand the code below. It is a working sample so you should be able to run it in a terminal and notice that the GUI is responsive and that you have messages being printed out on the terminal. The code I provided below is more complicated than you may need for a proof-of-concept kind of program, but if you will be communicating with physical devices I suggest something like this. I am by no means and expert, but I have been doing something similar to what you are doing. I also suggest maybe separating the device communication into another module/class, especially if others are going to (re)use your code. Good Luck, Dave P.S. There are a lot of Qt4/PyQt4 threading examples online, but not all of them correct. What I posted below is what I have found to be considered "correct" by most people. ################# ### Sample Code ### ################# import time from PyQt4 import QtGui,QtCore class MyWindow(QtGui.QWidget): def __init__(self): QtGui.QWidget.__init__(self) # Sample GUI elements to test responsiveness the_choices = ["item"]*20 self.choices = QtGui.QComboBox() self.choices.addItems(the_choices) self.layout = QtGui.QVBoxLayout(self) self.layout.addWidget(self.choices) self.setLayout(self.layout) def handle_new_data(self): # This is where you could redraw any matplotlib plots # Maybe send data through the signal/slot connection print "Updating data" class MyInstrument(QtCore.QObject): signal_new_data = QtCore.pyqtSignal(name="signal_new_data") signal_closing = QtCore.pyqtSignal(name="signal_closing") def run(self): self._timer = QtCore.QTimer() self._timer.timeout.connect(self._run) self._timer.start(0) def _run(self): time.sleep(1) print "Running the instrument function" time.sleep(1) self.signal_new_data.emit() def close(self): print "Closing instrument thread" self._timer.stop() # Redundant timer stop self._timer.timeout.disconnect() self.signal_closing.emit() if __name__ == "__main__": app = QtGui.QApplication([" "]) w = MyWindow() w.show() instrument = MyInstrument() instrument_thread = QtCore.QThread() instrument.moveToThread(instrument_thread) instrument_thread.started.connect(instrument.run) instrument.signal_new_data.connect(w.handle_new_data) # Make the close function run in the main thread so you can "interrupt" the sleeps app.lastWindowClosed.connect(instrument.close, QtCore.Qt.DirectConnection) # You could also call quit "manually" after exec_() returns instrument.signal_closing.connect(instrument_thread.quit) instrument_thread.start() app.exec_() #instrument_thread.quit() print "Waiting for instrument thread..." instrument_thread.wait() print "SUCCESS" ###################### ### End of Sample Code ### ###################### On 12/14/11 3:51 AM, Fabien Lafont wrote: > I prefer to use the multi-thread method beacause it's easier for me > and my colaborators to have the entire acquisition process at the same > place. Until then I use a simple one but I hope to use a more complex > one in few weeks ( put different voltages on different devices then > measure many voltages or current). If I use the "domino" technique > (call the next operation by the end of the previous) it can be complex > to read and to edit. Thank you very much anyway! > > How can I write a multi-thread process? I've just tried to add > qApp.processEvents() at the end of my while loop but it doesn't change > anything... > > Thanks again, > > Fabien > > 2011年12月13日 David Hoese<dh...@gm...>: >> Yeah I didn't think about suggesting that, but I think it might get >> complicated. I think he would have to start a one shot timer to call a >> function to set the voltage. Then that function would also start another >> one shot timer to call another function that would read from the sample. >> That function then would start a one shot timer to call the first function >> again. This way he can be sure that things are called in order and that >> timing is consistent, just in case the GUI gets complicated or something >> makes the event loop slow down. >> >> He could also use multiple threads. Whatever works for Fabien I guess. >> >> -Dave >> >> On 12/13/11 1:00 PM, mat...@li... wrote: >>> From: "Drain, Theodore R (343P)"<the...@jp...> >>> >>> Subject: Re: [Matplotlib-users] [ploting data] Live data >>> >>> Perhaps I'm missing something, but why not use QTimer? You can't really >>> every call sleep in a single threaded gui (for reasons you've encountered). >>> If you need to poll something, create a QTimer for 2 seconds and have it >>> call a measurement function to update the data. You shouldn't need any >>> processEvents calls or sleep. >>
Thx Seb! 2011年12月14日 Benjamin Root <ben...@ou...>: > > > On Wednesday, December 14, 2011, Fabien Lafont <laf...@gm...> > wrote: >> I have a basic problem (I think) >> >> I try to fit some data with this function >> >> http://docs.scipy.org/doc/numpy/reference/generated/numpy.polynomial.Chebyshev.fit.html >> >> But it return an error: >> >> fit = chebyshev.fit(T,R,3) >> NameError: name 'chebyshev' is not defined >> >> I don't understand I've imported Numpy and polynomials... An Idea? >> >> >> import math >> from numpy import * >> from numpy import polynomial >> from pylab import * >> from scipy import * >> from scipy import optimize >> import warnings >> warnings.simplefilter('ignore', np.RankWarning) >> >> >> R = [ 9011.5 , 7822.7 , 6253.9 , 4877.56 , 3892.08 , >> 3221.41 , 2647.05, >> 2260.94 , 1959.72 , 1712.06 , 1522.28 , 1367.87 , 1242.953 >> , 1185.092, >> 1104.452 , 1031.862 , 919.8644 , 832.9942 , 767.8944 , 715.1569, >> 671.6301 , 635.1634 , 604.284 , 577.5536] >> >> T = range(0,len(R)) >> plot (T,R,".") >> show() >> fit = chebyshev.fit(T,R,3) >> print fit >> > > The function would be in the "polynomial" namespace. So > "polynomial.chebyshev()" would work. To reduce typing, you can import a > module "as" some other name. > > from numpy import polynomial as poly > > .. > > fit = poly.chebyshev.fit(T,R,3) > > Importing modules is very flexible and I suggest reading up on it. > > Ben Root
On Wednesday, December 14, 2011, Fabien Lafont <laf...@gm...> wrote: > I have a basic problem (I think) > > I try to fit some data with this function > http://docs.scipy.org/doc/numpy/reference/generated/numpy.polynomial.Chebyshev.fit.html > > But it return an error: > > fit = chebyshev.fit(T,R,3) > NameError: name 'chebyshev' is not defined > > I don't understand I've imported Numpy and polynomials... An Idea? > > > import math > from numpy import * > from numpy import polynomial > from pylab import * > from scipy import * > from scipy import optimize > import warnings > warnings.simplefilter('ignore', np.RankWarning) > > > R = [ 9011.5 , 7822.7 , 6253.9 , 4877.56 , 3892.08 , > 3221.41 , 2647.05, > 2260.94 , 1959.72 , 1712.06 , 1522.28 , 1367.87 , 1242.953 > , 1185.092, > 1104.452 , 1031.862 , 919.8644 , 832.9942 , 767.8944 , 715.1569, > 671.6301 , 635.1634 , 604.284 , 577.5536] > > T = range(0,len(R)) > plot (T,R,".") > show() > fit = chebyshev.fit(T,R,3) > print fit > The function would be in the "polynomial" namespace. So "polynomial.chebyshev()" would work. To reduce typing, you can import a module "as" some other name. from numpy import polynomial as poly .. fit = poly.chebyshev.fit(T,R,3) Importing modules is very flexible and I suggest reading up on it. Ben Root
I have a basic problem (I think) I try to fit some data with this function http://docs.scipy.org/doc/numpy/reference/generated/numpy.polynomial.Chebyshev.fit.html But it return an error: fit = chebyshev.fit(T,R,3) NameError: name 'chebyshev' is not defined I don't understand I've imported Numpy and polynomials... An Idea? import math from numpy import * from numpy import polynomial from pylab import * from scipy import * from scipy import optimize import warnings warnings.simplefilter('ignore', np.RankWarning) R = [ 9011.5 , 7822.7 , 6253.9 , 4877.56 , 3892.08 , 3221.41 , 2647.05, 2260.94 , 1959.72 , 1712.06 , 1522.28 , 1367.87 , 1242.953 , 1185.092, 1104.452 , 1031.862 , 919.8644 , 832.9942 , 767.8944 , 715.1569, 671.6301 , 635.1634 , 604.284 , 577.5536] T = range(0,len(R)) plot (T,R,".") show() fit = chebyshev.fit(T,R,3) print fit
You'll want to set the rcParam "pdf.fonttype" to 42 to embed the entire TTF file in the PDF file, allowing for editing text as text. Mike On 12/13/2011 01:23 PM, Hongchun Jin wrote: > *Hi folks, * > * > * > *I try to use the PDF backend in my plotting script, when I expect to > have a pdf figure. However, when I open the figure in Adobe > Illustrator, it turns out that the fonts are not "real fonts". I mean > I want to be able to directly edit them. For example, when I double > click the fonts or use other ways, I want to edit the fonts without > deleting them and replacing with new ones. Am I missing something or > not doing it correctly? * > * > * > *Sample: * > * > # use PDF backends > import matplotlib > matplotlib.use('PDF') > import matplotlib.pyplot as plt > .......... > fig = plt.figure() > .......... > fig.savefig('sample.pdf') > > > **Best, > > Hongchun > > * > > > ------------------------------------------------------------------------------ > Systems Optimization Self Assessment > Improve efficiency and utilization of IT resources. Drive out cost and > improve service delivery. Take 5 minutes to use this Systems Optimization > Self Assessment. http://www.accelacomm.com/jaw/sdnl/114/51450054/ > > > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Hi, the quiver function has an alpha argument to set the transparency for all arrows globally. Is there any way to set the transparency for individual arrows? Heiko -- -- Trenne dich nie von deinen Illusionen und Träumen. Wenn sie -- verschwunden sind, wirst du weiter existieren, aber aufgehört haben, -- zu leben. (Mark Twain, am. Schriftsteller, 1835-1903) -- Number Crunch Blog @ http://numbercrunch.de
I prefer to use the multi-thread method beacause it's easier for me and my colaborators to have the entire acquisition process at the same place. Until then I use a simple one but I hope to use a more complex one in few weeks ( put different voltages on different devices then measure many voltages or current). If I use the "domino" technique (call the next operation by the end of the previous) it can be complex to read and to edit. Thank you very much anyway! How can I write a multi-thread process? I've just tried to add qApp.processEvents() at the end of my while loop but it doesn't change anything... Thanks again, Fabien 2011年12月13日 David Hoese <dh...@gm...>: > Yeah I didn't think about suggesting that, but I think it might get > complicated. I think he would have to start a one shot timer to call a > function to set the voltage. Then that function would also start another > one shot timer to call another function that would read from the sample. > That function then would start a one shot timer to call the first function > again. This way he can be sure that things are called in order and that > timing is consistent, just in case the GUI gets complicated or something > makes the event loop slow down. > > He could also use multiple threads. Whatever works for Fabien I guess. > > -Dave > > On 12/13/11 1:00 PM, mat...@li... wrote: >> >> From: "Drain, Theodore R (343P)"<the...@jp...> >> >> Subject: Re: [Matplotlib-users] [ploting data] Live data >> >> Perhaps I'm missing something, but why not use QTimer? You can't really >> every call sleep in a single threaded gui (for reasons you've encountered). >> If you need to poll something, create a QTimer for 2 seconds and have it >> call a measurement function to update the data. You shouldn't need any >> processEvents calls or sleep. > >
Hi, For anyone still interested in this topic: I implemented a provisional solution myself, but it turned out that there is indeed already an example for a marker/cursor in the matplotlib documentation. It can be found at http://matplotlib.sourceforge.net/examples/pylab_examples/cursor_demo.html Cheers, Sven
On 12/13/2011 11:03 AM, Nico Schlömer wrote: > Hi all, > > when drawing contourf plots, I inspected the underlying > matplotlib.path.Path elements that determine the curves and noticed > that they are all of code LINETO (see > http://matplotlib.sourceforge.net/api/path_api.html#matplotlib.path.Path) > although the number of vertices is 6, actually suggesting a CURVE4. > > Would that be a bug? I don't see it. x = np.arange(9) x.shape = (3,3) cs = contourf(x, 1) print cs.collections.get_paths() This shows a set of vertices with a matching set of LINETO (after an initial MOVETO). contour and contourf generate piece-wise linear paths with vertices on grid cell boundaries; they make no attempt to smooth out the contours. Eric > > Cheers, > Nico
On Tue, Dec 13, 2011 at 3:55 PM, Nico Schlömer <nic...@gm...>wrote: > > "RGB and RGBA are sequences of, respectively, 3 or 4 floats in the range > 0-1." > > That would explain it. It also seems that I never ever will have to > worry about CMYK values as they don't seem to be used anywhere in > matplotlib as a search on the website for "cmyk" suggests. > > --Nico > > Correct. Matplotlib currently does not support CMYK representation. The fourth element is the alpha (transparency) value. Ben Root
> "RGB and RGBA are sequences of, respectively, 3 or 4 floats in the range 0-1." That would explain it. It also seems that I never ever will have to worry about CMYK values as they don't seem to be used anywhere in matplotlib as a search on the website for "cmyk" suggests. --Nico On Tue, Dec 13, 2011 at 10:19 PM, Vlastimil Brom <vla...@gm...> wrote: > 2011年12月13日 Nico Schlömer <nic...@gm...>: >> Hi, >> >> upon extracting the face color of a matplotlib.path.Path object, >> >> fc = obj.get_facecolor() >> >> I always seem to get an array of length 4. This initially led me to >> believe I'm dealing with CMYK values, but it really seems like the >> last entry is *always* 1.0 and the first three give the RGB >> representation of the respective color. >> Is there any documentation on color codes usage in matplotlib? >> >> Cheers, >> Nico >>... > > Hi, > maybe: > http://matplotlib.sourceforge.net/api/colors_api.html#module-matplotlib.colors > > "RGB and RGBA are sequences of, respectively, 3 or 4 floats in the range 0-1." > > hth, > vbr > > ------------------------------------------------------------------------------ > Systems Optimization Self Assessment > Improve efficiency and utilization of IT resources. Drive out cost and > improve service delivery. Take 5 minutes to use this Systems Optimization > Self Assessment. http://www.accelacomm.com/jaw/sdnl/114/51450054/ > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
2011年12月13日 Nico Schlömer <nic...@gm...>: > Hi, > > upon extracting the face color of a matplotlib.path.Path object, > > fc = obj.get_facecolor() > > I always seem to get an array of length 4. This initially led me to > believe I'm dealing with CMYK values, but it really seems like the > last entry is *always* 1.0 and the first three give the RGB > representation of the respective color. > Is there any documentation on color codes usage in matplotlib? > > Cheers, > Nico >... Hi, maybe: http://matplotlib.sourceforge.net/api/colors_api.html#module-matplotlib.colors "RGB and RGBA are sequences of, respectively, 3 or 4 floats in the range 0-1." hth, vbr
Hi, upon extracting the face color of a matplotlib.path.Path object, fc = obj.get_facecolor() I always seem to get an array of length 4. This initially led me to believe I'm dealing with CMYK values, but it really seems like the last entry is *always* 1.0 and the first three give the RGB representation of the respective color. Is there any documentation on color codes usage in matplotlib? Cheers, Nico
Hi all, when drawing contourf plots, I inspected the underlying matplotlib.path.Path elements that determine the curves and noticed that they are all of code LINETO (see http://matplotlib.sourceforge.net/api/path_api.html#matplotlib.path.Path) although the number of vertices is 6, actually suggesting a CURVE4. Would that be a bug? Cheers, Nico
Hello, I have 2D array where each (x, y) cell represents the height of that point on the Z axis (you can think of it as the map of some mountain chain). I'd like to get the plot_surface() of this data. What I don't understand in particular is the content of the X, Y ,Z array parameter in my particular example. Can anybody elaborate on this please? Thanks! Claudio -- Claudio Martella cla...@vu...
Yeah I didn't think about suggesting that, but I think it might get complicated. I think he would have to start a one shot timer to call a function to set the voltage. Then that function would also start another one shot timer to call another function that would read from the sample. That function then would start a one shot timer to call the first function again. This way he can be sure that things are called in order and that timing is consistent, just in case the GUI gets complicated or something makes the event loop slow down. He could also use multiple threads. Whatever works for Fabien I guess. -Dave On 12/13/11 1:00 PM, mat...@li... wrote: > From: "Drain, Theodore R (343P)"<the...@jp...> > Subject: Re: [Matplotlib-users] [ploting data] Live data > > Perhaps I'm missing something, but why not use QTimer? You can't really every call sleep in a single threaded gui (for reasons you've encountered). If you need to poll something, create a QTimer for 2 seconds and have it call a measurement function to update the data. You shouldn't need any processEvents calls or sleep.