Re: [Matplotlib-users] Is matplotlib compatible whith PyQt4 ?
On 8/19/06, Darren Dale [EMAIL PROTECTED] wrote: On Friday 18 August 2006 08:27, Darren Dale wrote: On Wednesday 16 August 2006 04:54, Samuel GARCIA wrote: Thank you, Sorry I did known the existence of matplotlib.backends.backend_qt4agg. It is more easy than I thought. but I still have a problem. This is my code : import sys from PyQt4.QtCore import * from PyQt4.QtGui import * from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas from matplotlib.figure import Figure # -- class MyWidget(QWidget): def __init__(self, parent=None): QWidget.__init__(self, parent) self.menuBar = QMenuBar() self.fileMenu = QMenu(self.tr(File), self) self.menuBar.addMenu(self.fileMenu) mainLayout = QVBoxLayout() mainLayout.setMenuBar(self.menuBar) self.setLayout(mainLayout) # -- if __name__ == __main__: app = QApplication(sys.argv) dialog = MyWidget() dialog.show() sys.exit(app.exec_()) and it does not works because the main window is blocking. There is a comment in the embedding_in_qt.py example: # The QApplication has to be created before backend_qt is imported, otherwise # it will create one itself. This goes for qt4 as well, and is the source of the problem. You can have only one QApplication at a time. (Ted, John, do you think the QApplication really needs to be created during the module import? show() is the only function that looks for the QApplication, maybe the qApp should be created there instead. Any reason against?) I added an example, embedding_in_qt4.py, to the svn repository. It is closely based on embedding_in_qt.py. From what I saw, creating QApp in show makes more sense. - Charlie - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] copy to graph to clipboard
On Saturday 19 August 2006 13:18, Hubert Fitch wrote: Hi! Matplotlib is great! (For some unknown reason Matplotlib did not work until I finally bought a differnt Windows XP computer). Finally after about a year of trying, I can plot! but when the figure is on screen, how can I quickly grab it and save it to a png file? Just click the save button on the toolbar at the bottom of the window. - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] remove text from a plot
Aaron, Each text object that you add with the text() function is appended to a list called texts that is an attribute of the axes object. So, to remove the last text object you added, you can do: del gca().texts[-1] draw() If what you want to do is change the contents but not the position, you can do: gca().texts[-1].set_text('Big Mistake') draw() If you want to change the position, you can do: gca().texts[-1].set_position((3,4)) draw() Note that in the set_position method, unlike the text() function, the position is specified as an (x,y) tuple; the parentheses are required. Or you can just shift one coordinate: gca().texts[-1].set_x(5) draw() If you want to change the first text object, then of course you would use texts[0] instead of texts[-1], etc. There is an alternative pylab function for setting properties that takes care of redrawing automatically. Here is an example: setp(gca().texts[-1], 'fontsize', 15) # Matlab-style or setp(gca().texts[-1], fontsize=17) # nicer style If you are going to want to experiment with the properties of your text object, then grab a reference to it when you create it, like this: tt = text(6,7,'another one') setp(tt, fontsize=15) That way you don't have to keep typing gca().texts[-1]. Eric Aaron Hoover wrote: Matplotlib is great. Between numpy, scipy, and matplotlib, I'm almost completely weaned myself off of Matlab (just need to rewrite a bunch of m-files in Python). My question is, is there an easy way to remove text that's been added with the text() function from a plot (like if I make a mistake in the text or its position)? I've thought about adding a long string of spaces in the same location, but haven't tried it yet. Is there an easier way like a clear() function or some other method I may have missed? Thanks, Aaron - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users