From: Jean-Baptiste C. <Jea...@de...> - 2004-02-27 13:58:30
|
S=E6l ! I have been developing a small interface based on matlpotlib. I must say I = really enjoy it. I came to the point of a lot of small questions, not found in the FAQ I am using matplotlib 0.50e on RedHat 9.0 linux and mainly the object picke= r class - I have 2 Suplots on top of each other, but when I select only one axis on= the drop-down button I get an error: Traceback (most recent call last): File "/usr/lib/python2.2/site-packages/matplotlib/backends/backend_gtk.py= ", line 987, in toggled if item=3D=3DitemAll: NameError: free variable 'itemAll' referenced before assignment in enclosin= g scope - I want to systematically disable the vertical zoom/move on the second sub= plot, but not the first. How can I do that ? - How can I activate a tooltip on top of my plots ? - I cannot zoom or move an plot I set the axis ticks to , ie ax.set_xticks(= []) - How could I add a button to directly print out the picture in the toolbar= ? - Is there any density plot available ? - Can I change the size taken by each of the Suplots ?=20 - I have MANY small plots on my graph. Is there a cost effective way to fil= ter which plots to show ? Thanks a lot for this great library ! Kve=F0ja Jean-Baptiste =09 --=20 ----------------------------- Jea...@de... Department of Statistics deCODE genetics Sturlugata,8 570 2993 101 Reykjav=EDk |
From: John H. <jdh...@ac...> - 2004-03-01 14:53:07
|
- I have 2 Suplots on top of each other, but when I select only one axis on the drop-down button I get an error: This was a python2.2 specific bug relating to nested scopes. It's fixed for the next release. - I want to systematically disable the vertical zoom/move on the second subplot, but not the first. How can I do that ? Well, when the menu is working properly that is how you do it. By "systematically", do you mean by default so it's disabled when the plot comes up? If so, this depends on how you are building your GUI window. Basically you need to get your hands on the gtk.Toolbar instance, which contains an omenu (gtk.OptionMenu) attribute (wait until the next release, a couple of days, where I've cleaned this up a bit). Eg, if you are using the matlab interface manager = get_current_fig_manager() items = manager.toolbar.omenuItems items[-1].set_active(False) Turns off navigation for the last subplot. items[0] would turn off navigation for the first subplot, and so on. Here are the docs for gtk.MenuItem - http://www.gnome.org/~james/pygtk-docs/class-gtkmenuitem.html - How can I activate a tooltip on top of my plots ? You'll have to read up on gtk tooltips. Depends on what elements you want to add tips to. Give me a little more info. DO you want to add tips to the navigation buttons or lines on your plot or text elements or what? http://www.gnome.org/~james/pygtk-docs/class-gtktooltips.html Also check out the pygtk FAQ http://www.async.com.br/faq/pygtk and tutorial http://www.moeraki.com/pygtktutorial/pygtk2tutorial/index.html. - I cannot zoom or move an plot I set the axis ticks to , ie ax.set_xticks([]) This is a bug - thanks for reporting it. I use the tick width as the default interval in pan. When there are no ticks, I divided by the number of ticks and got a division by zero error. I now check for 0 and default to 20% of the plot if there are no ticks. - How could I add a button to directly print out the picture in the toolbar ? Print as in to a printer? No support for that yet and am not sure I want to go there right now (cross platform printing would might take lot of work). Best I can offer you currently is the savefig button. I think gnome-print has made a fair amount of progress since I first wrote matplotlib so if you want to be on the vanguard and explore this option I would be happy. - Is there any density plot available ? Do you mean hist? http://matplotlib.sourceforge.net/screenshots.html#histogram_demo http://matplotlib.sourceforge.net/matplotlib.matlab.html#-hist - Can I change the size taken by each of the Suplots ? Just use axes. Subplot derives from Axes. With axes, you can set the size of your subplot with a rect [left, bottom, width, height] http://matplotlib.sourceforge.net/matplotlib.matlab.html#-axes http://matplotlib.sourceforge.net/matplotlib.axes.html http://matplotlib.sourceforge.net/screenshots.html#axes_demo - I have MANY small plots on my graph. Is there a cost effective way to filter which plots to show ? I don't know what this means. Wouldn't you want to show all the plots on your figure? Why else would you put them there? Please elaborate. Cheers, JDH |
From: Jean-Baptiste C. <Jea...@de...> - 2004-03-02 10:09:12
|
S=E6l=20 Thanks for the detailed answerS I will try to go one step further for the u= nclear question. I hope this will help other users too :) > - I want to systematically disable the vertical zoom/move on the > second subplot, but not the first. How can I do that ? >=20 > Well, when the menu is working properly that is how you do it. By > "systematically", do you mean by default so it's disabled when the > plot comes up? >=20 > If so, this depends on how you are building your GUI window. > Basically you need to get your hands on the gtk.Toolbar instance, > which contains an omenu (gtk.OptionMenu) attribute (wait until the > next release, a couple of days, where I've cleaned this up a bit). > Eg, if you are using the matlab interface >=20 > manager =3D get_current_fig_manager() > items =3D manager.toolbar.omenuItems > items[-1].set_active(False) >=20 > Turns off navigation for the last subplot. items[0] would turn off > navigation for the first subplot, and so on. Indeed I meant 'by default' and you answered partially my question. I would like to disable only the veritcal zoom, not the horizontal one. Is it possible ? > - How can I activate a tooltip on top of my plots ? >=20 > You'll have to read up on gtk tooltips. Depends on what elements you > want to add tips to. Give me a little more info. DO you want to add > tips to the navigation buttons or lines on your plot or text elements > or what? I am aware of tooltips in pygtk, and I would liek to use them on the axes o= nly. As I understood those axes are included in a figure which is a DrwaingArea.= But DrawingArea do not accept tooltip easily. Did you implement a workaround to have a tooltip on the axes > - How could I add a button to directly print out the picture in the too= lbar ? >=20 > Print as in to a printer? No support for that yet and am not sure I > want to go there right now (cross platform printing would might take > lot of work). Best I can offer you currently is the savefig button. > I think gnome-print has made a fair amount of progress since I first > wrote matplotlib so if you want to be on the vanguard and explore this > option I would be happy. I used the NavigationToolbar as a GTKToolbar and added a button with the fu= nction I wanted. This solved my problem > - Is there any density plot available ? >=20 > Do you mean hist? The histogram provide a similar plot to what I want. I am currently using it, but when i zoom horizontally I can get very few an= d large bars. Therefore I would be interested in a simple curve fitted to pass through al= l the tops of histograms. This would make the picture more consistent throughout the zooming If the curve was filled it would be even better :) > - I have MANY small plots on my graph. Is there a cost effective way > to filter which plots to show ? >=20 > I don't know what this means. Wouldn't you want to show all the plots > on your figure? Why else would you put them there? Please elaborate. Within one Sublot I have thousands of small "lines" plotted. This takes tim= e to draw and show on the screen Within my software I would like to be able to filter interactively that inf= ormation according to various criteria to show only few of them In order to do that cost effectively I was wondering if matplotlib provides= an option to show/hide specific "lines" that I could turn on/off That woudl avoid me to redraw the whole picture after 1 single change Takk Kve=F0ja Jean-Baptiste --=20 ----------------------------- Jea...@de... Department of Statistics deCODE genetics Sturlugata,8 570 2993 101 Reykjav=EDk |