Re: [Matplotlib-users] Fwd: Re: Autonomous display of image/plot/figure
James K. Gruetzner wrote: >>> I'm running Fedora 8, python 2.5.1, and matplotlib 0.91.2-1.fc8 from >>> the yum repository. Backend is set to GTKAgg in my matplotlibrc file. >> (On this list top-posting is frowned upon -- it makes the conversation >> difficult to follow.) > > I understand. Sorry. Each list is different: I'm new here, and will try > remember. No problem. Also, don't forget reply-to-all, so that the whole of the list can chime in here. :) >> Your analysis is correct, the call to show() activates the GUI mainloop >> and does not return until the window is closed. Within ipython there is >> some magic that occurs that runs the mainloop in a separate thread. >> What do you need to do after the call to show()? > > In my current situation, I need to extract and display data (images) > independently from several different files as part of debugging a larger > application. (I'm really not reading a file into the original array, but > running some shell commands using os.popen2(...) to eventually populate the > array: that part works.)The upshot is that in the course of a few hours, > I may have to display (and kill) a large number of images. > > The current "hang" means that I have an effective memory leak, and I'd have > to > keep track of Process IDs and manually kill them every so often. Were the > pylab.show() command to return after closing the window (clicking on the X), > then a backgrounded or daemon process should terminate. But it doesn't. > This seems to be the same problem causing Dragan S.'s problem. > > I'm not sure if this is a bug or a feature, but would assuredly like to find > a > way to kill the leak. > I'm not sure about the lack of returning after the call show(), though it does sound like a bug. What I *do* know is that multiple calls to show() is frowned upon (if not just completely unsupported). What you probably want to look at is the dynamic_image_gtkagg.py example (in the examples/ directory). Since you're already using GtkAgg, it should be *really* easy to adapt the example to fit your needs. I've personally adapted it to do a live data display of a simulation run. If you *need* it to wait for user interaction before continuing, there might be a little bit more work, but I don't think it'd be much. You could probably instead look at some of the Matplotlib UI widgets, like in the buttons.py example. Ryan -- Ryan May Graduate Research Assistant School of Meteorology University of Oklahoma - Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! Studies have shown that voting for your favorite open source project, along with a healthy diet, reduces your potential for chronic lameness and boredom. Vote Now at http://www.sourceforge.net/community/cca08 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] scale a circle properly (not from shapefile)
I am trying to do something similar to the plot_tissot.py example, but am having some problems. I would like to project a group of circles onto a map projection. Below is the code I developed, which doesn't work because I get the error: ==ERROR File "C:\Python25\Lib\site-packages\matplotlib\path.py", line 127, in __init__ assert vertices.ndim == 2 AssertionError == CODE = m = Basemap(llcrnrlon=-180,llcrnrlat=-80,urcrnrlon=180,urcrnrlat=80, projection='cyl') shp_info = m.readshapefile(r'C:\Documents and Settings\kpeters\My Documents\basemap-0.99\examples\tissot','tissot',drawbounds=True) ax = plt.gca() coords = [(116,45),(104,41),(98,37),(88,30),(78,25),(116,-45),(104,-41),(98,-37),(88,-30),(78,-25)] for lon1,lat1 in coords: newverts = [] circle = Circle((lon1,lat1),radius=10, facecolor='green') #trans = circle.get_patch_transform() path = circle.get_path() #for jj in path.iter_segments(): #looks like the iterator is broken??? for jj in path.vertices: verts1, verts2 = jj; newverts.append(m(verts1,verts2)) print newverts p = PolyCollection(newverts, facecolor='green', zorder = 10) ax.add_collection(p) ==END CODE== Is this a logical/best way to get circles properly projected, or is there a better way? I looked at "transform_vector" but I'm not too sure what the uin and vin do. Is there a transform in basemaps that could be passed to a path like in this thread: "Re: [Matplotlib-users] Drawing filled circles (discs)": "circle = CirclePolygon((x1,y1), r, resolution) trans = circle.get_patch_transform() path = circle.get_path() transpath = path.transformed(trans)" It should be noted that I also tried: ===code dif=== for lon1,lat1 in coords: newverts = [] circle = Circle((lon1,lat1),radius=10, facecolor='green') path = circle.get_path() #for jj in path.iter_segments(): #looks like the iterator is broken??? for jj in path.vertices: verts1, verts2 = jj; newverts.append(m(verts1,verts2)) print newverts #newcircle = Circle(m(lon1,lat1),radius=10, facecolor='green') p = Polygon(newverts, facecolor='green', zorder = 10) ax.add_patch(p) === but that doesn't seem to display anything (I suspect the right radius isn't being used). Note, that the "newcircle" line that is commented out, puts circles on the map, they're just not transformed right. Regards, Kurt - Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! Studies have shown that voting for your favorite open source project, along with a healthy diet, reduces your potential for chronic lameness and boredom. Vote Now at http://www.sourceforge.net/community/cca08 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] legend text vertical alignment
Hi, I have a problem with legends where the vertical spacing is sometimes a bit funny (lines don't seem to be evenly spaced). I am now preparing some figures for publication and this is the last niggle I'd really like to resolve. Is there anything I could do to fix this? A small example is attached (I cropped it to just the legend to reduce file size). I am setting the label on the bars I am plotting and then just calling ax.legend() At the risk of putting two queries in one email the only other problem I have regularly is that small figures resize themselves when the mouse rolls over them. I am using TkAgg backend on OS X but I think it happens on other platforms as well. On mouse over the window jiggles and resizes slightly. When I am saving figures I have to be careful to call savefig from the command line without touching the window with the mouse to ensure they save as the correct size. Just wondered if it was a known issue... Apart from these minor things though matplotlib has been performing great! Thanks, Robin bad_legend.pdf Description: Adobe PDF document - Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! Studies have shown that voting for your favorite open source project, along with a healthy diet, reduces your potential for chronic lameness and boredom. Vote Now at http://www.sourceforge.net/community/cca08___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] error with text object properties using matplotlib 0.98.1
Hi David, On Thursday 10 July 2008 11:15:37 am David M. Kaplan wrote: > 2) I have noticed that the font used for the xticklabels and the font > used for the xlabel and contour labels appears to be different (example > attached). One appears to be serif and the other sans-serif. This > seems to be due to using tex for text rendering. I am not sure if this > also occurred before the update, but I didn't notice it previously. It has always been this way. We tried a workaround once a couple years back and it turned into a real mess. > Looking at the properties of the different text objects, it isn't > apparent that there should be a difference - both have font properties > that indicate sans-serif, but the text of tick labels appears to be > surrounded by $'s forcing it through the text parser, while that of the > contour labels is not. Is this difference normal or expected? Is there > a way around this? In particular, I would like to use sans-serif for > everything - is this possible while still using tex? I think there is a package, sansmath or something like that, that will allow latex to use sans-serif fonts in math mode. You could try adding it to the text.latex.preamble rc setting, but that option is not officially supported. If you don't like the limitations of latex, you might want to turning off usetex and just use matplotlibs mathtext, which recently got a significant rewrite and is now quite capable thanks to Mike Droettboom. Here's some documentation too: http://matplotlib.sourceforge.net/doc/html/users/mathtext.html Darren - Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! Studies have shown that voting for your favorite open source project, along with a healthy diet, reduces your potential for chronic lameness and boredom. Vote Now at http://www.sourceforge.net/community/cca08 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] error with text object properties using matplotlib 0.98.1
David M. Kaplan wrote: > Hi, > > I just upgraded to matplotlib 0.98.1 on a ubuntu hardy heron system. I > have noticed two problems since the upgrade: > > 1) For any plot, if I try to look at the properties of a text object I > get an error related to FontProperties having no attribute 'items'. See > below: > > In [1]: plot(range(10)) > Out[1]: [] > > In [2]: xlh=get(gca(),'xticklabels') > > In [3]: get(xlh[0]) > > Traceback (most recent call last): > File "", line 1, in > File "/usr/lib/python2.5/site-packages/matplotlib/artist.py", line > 724, in get > return getp(o, *args, **kwargs) > File "/usr/lib/python2.5/site-packages/matplotlib/artist.py", line > 716, in getp > print '\n'.join(insp.pprint_getters()) > File "/usr/lib/python2.5/site-packages/matplotlib/artist.py", line > 684, in pprint_getters > s = str(val) > File "/usr/lib/python2.5/site-packages/matplotlib/font_manager.py", > line 681, in __str__ > return self.get_fontconfig_pattern() > File "/usr/lib/python2.5/site-packages/matplotlib/font_manager.py", > line 737, in get_fontconfig_pattern > return generate_fontconfig_pattern(self) > File > "/usr/lib/python2.5/site-packages/matplotlib/fontconfig_pattern.py", > line 164, in generate_fontconfig_pattern > for key, val in d.items(): > : 'FontProperties' object has no > attribute 'items' > Thanks for the report. This is a bug and should now be fixed in SVN. > 2) I have noticed that the font used for the xticklabels and the font > used for the xlabel and contour labels appears to be different (example > attached). One appears to be serif and the other sans-serif. This > seems to be due to using tex for text rendering. I am not sure if this > also occurred before the update, but I didn't notice it previously. > Looking at the properties of the different text objects, it isn't > apparent that there should be a difference - both have font properties > that indicate sans-serif, but the text of tick labels appears to be > surrounded by $'s forcing it through the text parser, while that of the > contour labels is not. Is this difference normal or expected? Is there > a way around this? In particular, I would like to use sans-serif for > everything - is this possible while still using tex? > To clarify -- you've set the rcParam "text.usetex" to True? If the tick labels are in fact surrounded by $'s, then, yes, TeX will render then in a serif font. This is the default behavior of TeX (math is in a serif font) -- though there might be a special package you could add to the preamble (the rcParam text.latex.preamble) to change this, but that's more of a (La)TeX issue. Looking at the revision history, it looks like putting $'s around tick labels has been done since at least 0.90.1. Perhaps one of the usetex developers/users has more insight into this than I do. Cheers, Mike -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA - Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! Studies have shown that voting for your favorite open source project, along with a healthy diet, reduces your potential for chronic lameness and boredom. Vote Now at http://www.sourceforge.net/community/cca08 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Error when running multiple jobs utilizing the Tex utilities in matplotlib
On Thursday 10 July 2008 10:48:01 am you wrote: > Hi Darren, > > I have tried rerunning our code with the change you suggested in the > make_dvi and make_png functions. I am still noticing failures however. I > put these at the bottom of this message. Strangely enough, these errors > don't seem to occur when there are a lot of files in my tex.cache > directory. For example, I ran the code (consisting of ~40 codes all making > ~10-20 plots each), successfully 3 times (the OSError wasn't raised at all, > I used a print statement to check). I realised after this that a lot of > temp files were in my tex.cache directory, so I emptied it and then I > noticed that a lot of failures occured when I ran the code the next time > (the OSError I showed previously was raised as well as the error messages > shown below). It seems weird that it should run fine when a lot of files > are left in my temp directory and not when it is empty? Most of those files are not temporary files, but cached files. The error you reported only occurs when a required file does not already exist in the cache, and like you said, it appears to be the case that two jobs are trying to add the same file to the cache at the same time, and one job is failing because the other deletes a temporary file that is being used by both. I guess. > Here are the error messages that are occuring now: > > Traceback (most recent call last): > File > "/home/spxiwh/ihope/85245-85270/nsbhinj_summary_plots/../executable >s/plotinspmissed", line 625, in ? > savePlot( opts, filename, titleText) > File > "/home/spxiwh/ihope/85245-85270/nsbhinj_summary_plots/../executable >s/plotinspmissed", line 108, in savePlot > dpi_thumb=opts.figure_resolution) > File > "/home/spxiwh/lscsoft/executables/cbc_s5_1yr_20070129/pylal//lib64/python2. >4/site-packages/pylal/InspiralUtils.py", line 54, in savefig_pylal > fig.savefig(filename, dpi=dpi) > File "/home/spxiwh/test/matplotlib/figure.py", line 682, in savefig > self.canvas.print_figure(*args, **kwargs) > File "/home/spxiwh/test/matplotlib/backends/backend_agg.py", line 456, in > print_figure > self.draw() > File "/home/spxiwh/test/matplotlib/backends/backend_agg.py", line 392, in > draw > self.figure.draw(renderer) > File "/home/spxiwh/test/matplotlib/figure.py", line 544, in draw > for a in self.axes: a.draw(renderer) > File "/home/spxiwh/test/matplotlib/axes.py", line 1063, in draw > a.draw(renderer) > File "/home/spxiwh/test/matplotlib/axis.py", line 595, in draw > self.label.draw(renderer) > File "/home/spxiwh/test/matplotlib/text.py", line 340, in draw > bbox, info = self._get_layout(renderer) > File "/home/spxiwh/test/matplotlib/text.py", line 187, in _get_layout > w,h = renderer.get_text_width_height( > File "/home/spxiwh/test/matplotlib/backends/backend_agg.py", line 240, in > get_text_width_height > Z = texmanager.get_rgba(s, size, self.dpi.get(), rgb) > File "/home/spxiwh/test/matplotlib/texmanager.py", line 334, in get_rgba > pngfile = self.make_png(tex, fontsize, dpi, force=False) > File "/home/spxiwh/test/matplotlib/texmanager.py", line 255, in make_png > fh = file(outfile) > IOError: [Errno 2] No such file or directory: > '/home/spxiwh/.matplotlib/tex.cache/fb2014e54961855bd04020b61190867c.output >' That doesnt make any sense to me. file defaults to open a file in append mode, it doesnt matter if a file exists or not. Maybe you could try to figure out why that fails and report back. > And once I noticed: > > Traceback (most recent call last): > File > "/home/spxiwh/ihope/85245-85270/allinj_summary_plots/../executables >/plotinspmissed", line 661, in ? > dpi_thumb=opts.figure_resolution) > File > "/home/spxiwh/lscsoft/executables/cbc_s5_1yr_20070129/pylal//lib64/python2. >4/site-packages/pylal/InspiralUtils.py", line 54, in savefig_pylal > fig.savefig(filename, dpi=dpi) > File "/usr/lib64/python2.4/site-packages/matplotlib/figure.py", line 682, > in savefig > self.canvas.print_figure(*args, **kwargs) > File > "/usr/lib64/python2.4/site-packages/matplotlib/backends/backend_agg.py", > line 456, in print_figure > self.draw() > File > "/usr/lib64/python2.4/site-packages/matplotlib/backends/backend_agg.py", > line 392, in draw > self.figure.draw(renderer) > File "/usr/lib64/python2.4/site-packages/matplotlib/figure.py", line 544, > in draw > for a in self.axes: a.draw(renderer) > File "/usr/lib64/python2.4/site-packages/matplotlib/axes.py", line 1063, > in draw > a.draw(renderer) > File "/usr/lib64/python2.4/site-packages/matplotlib/text.py", line 340, > in draw > bbox, info = self._get_layout(renderer) > File "/usr/lib64/python2.4/site-packages/matplotlib/text.py", line 187, > in _get_layout > w,h = renderer.get_text_width_height( > File > "/usr/lib64/python2.4/site-packages/matplotlib/backends/backend_agg.py", > line 240, in get_text_width_height
[Matplotlib-users] Picker line selection after axes scale change.. possible bug?
If I do some 2D line plots, I can activate the picker event on each line.. but if I change the scale of the axes using axes.set_xscale('log') / axes.set_yscale('log') and then try to pick the lines, nothing happens. I can't select them on the plot with the log scales, but if I click in the area where they used to be on the linear scale the picker event is triggered correctly... I guess this is a bug? Cheers, Soren - Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! Studies have shown that voting for your favorite open source project, along with a healthy diet, reduces your potential for chronic lameness and boredom. Vote Now at http://www.sourceforge.net/community/cca08___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Error when running multiple jobs utilizing the Tex utilities in matplotlib
Hi Darren, I have tried rerunning our code with the change you suggested in the make_dvi and make_png functions. I am still noticing failures however. I put these at the bottom of this message. Strangely enough, these errors don't seem to occur when there are a lot of files in my tex.cache directory. For example, I ran the code (consisting of ~40 codes all making ~10-20 plots each), successfully 3 times (the OSError wasn't raised at all, I used a print statement to check). I realised after this that a lot of temp files were in my tex.cache directory, so I emptied it and then I noticed that a lot of failures occured when I ran the code the next time (the OSError I showed previously was raised as well as the error messages shown below). It seems weird that it should run fine when a lot of files are left in my temp directory and not when it is empty? Here are the error messages that are occuring now: Traceback (most recent call last): File "/home/spxiwh/ihope/85245-85270/nsbhinj_summary_plots/../executables/plotinspmissed", line 625, in ? savePlot( opts, filename, titleText) File "/home/spxiwh/ihope/85245-85270/nsbhinj_summary_plots/../executables/plotinspmissed", line 108, in savePlot dpi_thumb=opts.figure_resolution) File "/home/spxiwh/lscsoft/executables/cbc_s5_1yr_20070129/pylal//lib64/python2.4/site-packages/pylal/InspiralUtils.py", line 54, in savefig_pylal fig.savefig(filename, dpi=dpi) File "/home/spxiwh/test/matplotlib/figure.py", line 682, in savefig self.canvas.print_figure(*args, **kwargs) File "/home/spxiwh/test/matplotlib/backends/backend_agg.py", line 456, in print_figure self.draw() File "/home/spxiwh/test/matplotlib/backends/backend_agg.py", line 392, in draw self.figure.draw(renderer) File "/home/spxiwh/test/matplotlib/figure.py", line 544, in draw for a in self.axes: a.draw(renderer) File "/home/spxiwh/test/matplotlib/axes.py", line 1063, in draw a.draw(renderer) File "/home/spxiwh/test/matplotlib/axis.py", line 595, in draw self.label.draw(renderer) File "/home/spxiwh/test/matplotlib/text.py", line 340, in draw bbox, info = self._get_layout(renderer) File "/home/spxiwh/test/matplotlib/text.py", line 187, in _get_layout w,h = renderer.get_text_width_height( File "/home/spxiwh/test/matplotlib/backends/backend_agg.py", line 240, in get_text_width_height Z = texmanager.get_rgba(s, size, self.dpi.get(), rgb) File "/home/spxiwh/test/matplotlib/texmanager.py", line 334, in get_rgba pngfile = self.make_png(tex, fontsize, dpi, force=False) File "/home/spxiwh/test/matplotlib/texmanager.py", line 255, in make_png fh = file(outfile) IOError: [Errno 2] No such file or directory: '/home/spxiwh/.matplotlib/tex.cache/fb2014e54961855bd04020b61190867c.output' Traceback (most recent call last): File "/home/spxiwh/ihope/85245-85270/bnsinj_summary_plots/../executables/plotinspinj", line 569, in ? 'end_time', 'days', opts.time_axis, plot_type = 'linear' ) File "/home/spxiwh/ihope/85245-85270/bnsinj_summary_plots/../executables/plotinspinj", line 94, in plot_parameter_accuracy dpi_thumb=opts.figure_resolution) File "/home/spxiwh/lscsoft/executables/cbc_s5_1yr_20070129/pylal//lib64/python2.4/site-packages/pylal/InspiralUtils.py", line 54, in savefig_pylal fig.savefig(filename, dpi=dpi) File "/home/spxiwh/test/matplotlib/figure.py", line 682, in savefig self.canvas.print_figure(*args, **kwargs) File "/home/spxiwh/test/matplotlib/backends/backend_agg.py", line 456, in print_figure self.draw() File "/home/spxiwh/test/matplotlib/backends/backend_agg.py", line 392, in draw self.figure.draw(renderer) File "/home/spxiwh/test/matplotlib/figure.py", line 544, in draw for a in self.axes: a.draw(renderer) File "/home/spxiwh/test/matplotlib/axes.py", line 1063, in draw a.draw(renderer) File "/home/spxiwh/test/matplotlib/axis.py", line 561, in draw tick.draw(renderer) File "/home/spxiwh/test/matplotlib/axis.py", line 161, in draw if self.label1On: self.label1.draw(renderer) File "/home/spxiwh/test/matplotlib/text.py", line 838, in draw Text.draw(self, renderer) File "/home/spxiwh/test/matplotlib/text.py", line 340, in draw bbox, info = self._get_layout(renderer) File "/home/spxiwh/test/matplotlib/text.py", line 187, in _get_layout w,h = renderer.get_text_width_height( File "/home/spxiwh/test/matplotlib/backends/backend_agg.py", line 240, in get_text_width_height Z = texmanager.get_rgba(s, size, self.dpi.get(), rgb) File "/home/spxiwh/test/matplotlib/texmanager.py", line 334, in get_rgba pngfile = self.make_png(tex, fontsize, dpi, force=False) File "/home/spxiwh/test/matplotlib/texmanager.py", line 247, in make_png dvifile = self.make_dvi(tex, fontsize) File "/home/spxiwh/test/matplotlib/texmanager.py", line 223, in make_dvi fh = file(outfile) IOError: [Errno 2] No such file or directory: '/home/spxiwh/.matp
Re: [Matplotlib-users] Missing lines after a axes scale change
Changing the scale shouldn't remove the lines -- but it's possible there is a bug that moves them out of the visible area. Can you provide some standalone code that reproduces this problem? Cheers, Mike Søren Nielsen wrote: > Hi, > > When I change the xscale and yscale my plots go missing... i use > axes.set_xscale('linear'), axes.set_yscale('liner) or > axes.set_xscale('log'), axes.set_yscale('log') ... I have a button > that changes between those two.. but a change removes the 2D lines i > have on them... do I need to change something in the line objects too? > > Regards, > Soren > > > - > Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! > Studies have shown that voting for your favorite open source project, > along with a healthy diet, reduces your potential for chronic lameness > and boredom. Vote Now at http://www.sourceforge.net/community/cca08 > > > ___ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA - Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! Studies have shown that voting for your favorite open source project, along with a healthy diet, reduces your potential for chronic lameness and boredom. Vote Now at http://www.sourceforge.net/community/cca08 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Missing lines after a axes scale change
Hi, When I change the xscale and yscale my plots go missing... i use axes.set_xscale('linear'), axes.set_yscale('liner) or axes.set_xscale('log'), axes.set_yscale('log') ... I have a button that changes between those two.. but a change removes the 2D lines i have on them... do I need to change something in the line objects too? Regards, Soren - Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! Studies have shown that voting for your favorite open source project, along with a healthy diet, reduces your potential for chronic lameness and boredom. Vote Now at http://www.sourceforge.net/community/cca08___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Running matplotlib as a separate thread
Hi everybody! I am new to matplotlib and I have a question. I am running matplotlib from a main program in python as a separate thread. When I first launch matplotlib it works fine. On my second try when the main program is still running I try to execute it again but the plotting window is shown only for a sec and then it disappears. The last command is show(). This show() command should block the thread from dying and should unblock, leave the thread to die, when I close the matplotlib plotting window. Somehow this doesn't happen. Any clues on how I can fix this? Maybe I should be using something else then show() method? Manny thanks! Cheers, Dragan. - Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! Studies have shown that voting for your favorite open source project, along with a healthy diet, reduces your potential for chronic lameness and boredom. Vote Now at http://www.sourceforge.net/community/cca08 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Error when running multiple jobs utilizing the Tex utilities in matplotlib
Hi Ian, On Thursday 10 July 2008 06:03:54 am Ian Harry wrote: > Hi all, > > Myself and my colleagues use, and have used, matplotlib and it's Tex > capabilities quite extensively to create plots to assist in the > gravitational wave searches we perform. (and it has been a great tool for > us > > :-) ). However recently we have been running into problems when we have > > started automating our plot generation by running multiple plotting jobs > concurrently using the condor scheduler (and dagmans). Many of our plotting > jobs fail with messages such as the one below: > > ---snip--- > > Traceback (most recent call last): > File > "/home/romain/Projects/ > ligovirgo/s5_2yr_lv_lowcbc_20080625/868815014-868901414/868815014-868901414 >/inj001_summary_plots/../executables/plotinjnum", line 298, in ? >'eff_dist_h') > File > "/home/romain/Projects/ligovirgo/s5_2yr_lv_lowcbc_20080625/868815014-868901 >414/868815014-868901414/inj001_summary_plots/../executables/plotinjnum", > line 119, in plot_found_missed >fname_thumb = InspiralUtils.savefig_pylal(filename=fname, > doThumb=True, dpi_thumb=opts.figure_resolution) > File > "/home/romain/codes/s5_2yr_lv_lowcbc_20080625/pylal/lib64/python2.4/site-pa >ckages/pylal/InspiralUtils.py", line 58, in savefig_pylal >fig.savefig(filename_thumb, dpi=dpi_thumb) > > File "/usr/lib64/python2.4/site-packages/matplotlib/texmanager.py", line > 259, in make_png >os.remove(outfile) > OSError: [Errno 2] No such file or directory: > '/home/romain/.matplotlib/tex.cache/ae479c90ff242327b54af004a0846188.output >' > > ---snip--- > > My feeling is that when the code invokes the Tex 'bit' it creates a temp > file in ~/matplotlib/tex.cache and then deletes it and all other temp tex > files when it finishes the Tex 'bit'. This would cause problems if another > job is in the middle of running Tex when the other job deletes it's temp > files! > > We are running a slightly old version of matplotlib (0.87.7), as we run on > multiple clusters our sys admins tend to only update software when there is > a need to and we have had no other problems with matplotlib, I apologize if > this has been fixed in the meantime (I did do a quick search of the mailing > list archive but found nothing). All our clusters currently run Fedora Core > 4 (we're going to move to CentOS 5). > > Currently we are getting around this by forcing condor to retry the failed > jobs 2/3 times, this catches most of these errors. Another solution would > be to limit the number of jobs running to 1 BUT as we run dagmen from > within one 'super' dagman it would prove difficult to limit jobs from > multiple dagmen. > > Anyway if anyone has any ideas of how to solve this I would appreciate > this. Also if there are any options where we can set the location of these > temp tex files and use a different directory for each job (or stop > matplotlib deleting other temp files) that would help us. I'm really hesitant to mess around with the location of the temp files. It was a bit painfull trying to get usetex to work across platforms. Instead, would you try replacing: os.remove(outfile) with: try: os.remove(outfile) except OSError: pass Let me know if that fixes it, and if you need to wrap any other file deletions. Thanks, Darren - Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! Studies have shown that voting for your favorite open source project, along with a healthy diet, reduces your potential for chronic lameness and boredom. Vote Now at http://www.sourceforge.net/community/cca08 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Hiding line plots
Søren Nielsen wrote: > Is there a way I can hide a line plot? I have several line plots, and I > want to make a function to enable or disable a plot.. How do I tell each > line apart and remove/reinsert them? Try this in an interactive session, and see if it helps: ax = figure().add_subplot(111) a = ax.plot(rand(10), 'k')[0] b = ax.plot(rand(10), 'r')[0] ax.figure.canvas.draw() a.set_visible(False) ax.figure.canvas.draw() Regards, Antonio - Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! Studies have shown that voting for your favorite open source project, along with a healthy diet, reduces your potential for chronic lameness and boredom. Vote Now at http://www.sourceforge.net/community/cca08 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Hiding line plots
When you create the plot, it returns a list of line objects. You can use this object to remove itself from the axes, and add it back it later. Hope this helps:: In [1]: l1 = plot([1,2,3]) In [2]: l2 = plot([4,5,6]) In [4]: l1 Out[4]: [] # Remove the first plot In [6]: l1[0].remove() # Put it back In [9]: axes().add_line(l1[0]) Cheers, Mike Søren Nielsen wrote: > Hi, > > Is there a way I can hide a line plot? I have several line plots, and > I want to make a function to enable or disable a plot.. How do I tell > each line apart and remove/reinsert them? > > Anyone tried this? I was seeking for a line ID of somekind in > matplotlib.lines... but didn't see any. > > Thanks, > Soren > > > - > Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! > Studies have shown that voting for your favorite open source project, > along with a healthy diet, reduces your potential for chronic lameness > and boredom. Vote Now at http://www.sourceforge.net/community/cca08 > > > ___ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA - Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! Studies have shown that voting for your favorite open source project, along with a healthy diet, reduces your potential for chronic lameness and boredom. Vote Now at http://www.sourceforge.net/community/cca08 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Hiding line plots
Hi, Is there a way I can hide a line plot? I have several line plots, and I want to make a function to enable or disable a plot.. How do I tell each line apart and remove/reinsert them? Anyone tried this? I was seeking for a line ID of somekind in matplotlib.lines... but didn't see any. Thanks, Soren - Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! Studies have shown that voting for your favorite open source project, along with a healthy diet, reduces your potential for chronic lameness and boredom. Vote Now at http://www.sourceforge.net/community/cca08___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] import pylab produces rounding error
Angela Rivera Campos wrote: > Hi, > > I'm quite a newbie on matplotlib. > > I'm trying to get some data from a file. I've got a function that reads > the data from the file and stores it in a tuple as a set of floats. When > I use this without importing pylab it just go well but when I do it > after importing this module there's a rounding and I don't get the > proper data: > > > >>> import myModule as m > >>> spc = m.Collection() > >>> spc.ReadCollection('file') > >>> sp = spc.GetCSVBlock('00074') > >>> sp.GetDataRecord(0) > (0.0, 0.10001, 0.0503450001, 616.0, > 24.818, 616.0) > > --- > > >>> import myModule as m > >>> from pylab import * > >>> spc = m.Collection() > >>> spc.ReadCollection('file') > >>> sp = spc.GetCSVBlock('00074') > >>> sp.GetDataRecord(0) > (0.0, 0.0, 0.0, 616.0, 24.0, 616.0) > > > What's the problem here? What can I do to avoid it? Try import pylab instead of from pylab import * Manuel > Thanks in advance, > > AR > > - > Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! > Studies have shown that voting for your favorite open source project, > along with a healthy diet, reduces your potential for chronic lameness > and boredom. Vote Now at http://www.sourceforge.net/community/cca08 > ___ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users - Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! Studies have shown that voting for your favorite open source project, along with a healthy diet, reduces your potential for chronic lameness and boredom. Vote Now at http://www.sourceforge.net/community/cca08 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] import pylab produces rounding error
Hi, I'm quite a newbie on matplotlib. I'm trying to get some data from a file. I've got a function that reads the data from the file and stores it in a tuple as a set of floats. When I use this without importing pylab it just go well but when I do it after importing this module there's a rounding and I don't get the proper data: >>> import myModule as m >>> spc = m.Collection() >>> spc.ReadCollection('file') >>> sp = spc.GetCSVBlock('00074') >>> sp.GetDataRecord(0) (0.0, 0.10001, 0.0503450001, 616.0, 24.818, 616.0) --- >>> import myModule as m >>> from pylab import * >>> spc = m.Collection() >>> spc.ReadCollection('file') >>> sp = spc.GetCSVBlock('00074') >>> sp.GetDataRecord(0) (0.0, 0.0, 0.0, 616.0, 24.0, 616.0) What's the problem here? What can I do to avoid it? Thanks in advance, AR - Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! Studies have shown that voting for your favorite open source project, along with a healthy diet, reduces your potential for chronic lameness and boredom. Vote Now at http://www.sourceforge.net/community/cca08 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Questions about 3D plotting
On Wed, 2008-07-09 at 18:40 +0200, anirudh vij wrote: > > We have been warning that 3D plotting was unsupported and needed someone to > > volunteer to maintain it for quite a while now. Nobody answered the call, > > and > > 3d capabilities did not survive the transition to the new transforms in > > mpl-0.98, so it was removed, However... > > > > hmm. Mayavi2 has a mlab module thats under active development. It aims > to do the same stuff that matlab 3D plots do. However, svn currently > crashes for me. An alterative to mpl/mayavi for 3d is Pyx (see http://pyx.sourceforge.net/examples/3dgraphs/color.html ), although it's not interactive. BC - Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! Studies have shown that voting for your favorite open source project, along with a healthy diet, reduces your potential for chronic lameness and boredom. Vote Now at http://www.sourceforge.net/community/cca08 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Error when running multiple jobs utilizing the Tex utilities in matplotlib
Hi all, Myself and my colleagues use, and have used, matplotlib and it's Tex capabilities quite extensively to create plots to assist in the gravitational wave searches we perform. (and it has been a great tool for us :-) ). However recently we have been running into problems when we have started automating our plot generation by running multiple plotting jobs concurrently using the condor scheduler (and dagmans). Many of our plotting jobs fail with messages such as the one below: ---snip--- Traceback (most recent call last): File "/home/romain/Projects/ ligovirgo/s5_2yr_lv_lowcbc_20080625/868815014-868901414/868815014-868901414/inj001_summary_plots/../executables/plotinjnum", line 298, in ? 'eff_dist_h') File "/home/romain/Projects/ligovirgo/s5_2yr_lv_lowcbc_20080625/868815014-868901414/868815014-868901414/inj001_summary_plots/../executables/plotinjnum", line 119, in plot_found_missed fname_thumb = InspiralUtils.savefig_pylal(filename=fname, doThumb=True, dpi_thumb=opts.figure_resolution) File "/home/romain/codes/s5_2yr_lv_lowcbc_20080625/pylal/lib64/python2.4/site-packages/pylal/InspiralUtils.py", line 58, in savefig_pylal fig.savefig(filename_thumb, dpi=dpi_thumb) File "/usr/lib64/python2.4/site-packages/matplotlib/texmanager.py", line 259, in make_png os.remove(outfile) OSError: [Errno 2] No such file or directory: '/home/romain/.matplotlib/tex.cache/ae479c90ff242327b54af004a0846188.output' ---snip--- My feeling is that when the code invokes the Tex 'bit' it creates a temp file in ~/matplotlib/tex.cache and then deletes it and all other temp tex files when it finishes the Tex 'bit'. This would cause problems if another job is in the middle of running Tex when the other job deletes it's temp files! We are running a slightly old version of matplotlib (0.87.7), as we run on multiple clusters our sys admins tend to only update software when there is a need to and we have had no other problems with matplotlib, I apologize if this has been fixed in the meantime (I did do a quick search of the mailing list archive but found nothing). All our clusters currently run Fedora Core 4 (we're going to move to CentOS 5). Currently we are getting around this by forcing condor to retry the failed jobs 2/3 times, this catches most of these errors. Another solution would be to limit the number of jobs running to 1 BUT as we run dagmen from within one 'super' dagman it would prove difficult to limit jobs from multiple dagmen. Anyway if anyone has any ideas of how to solve this I would appreciate this. Also if there are any options where we can set the location of these temp tex files and use a different directory for each job (or stop matplotlib deleting other temp files) that would help us. Thanks in advance for any help Ian Harry -- --- Ian Harry School of Physics & Astronomy Queens Buildings, The Parade Cardiff, CF24 3AA Email: [EMAIL PROTECTED] Phone: (+44) 29 208 75120 Mobile: (+44) 7890 479090 --- - Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! Studies have shown that voting for your favorite open source project, along with a healthy diet, reduces your potential for chronic lameness and boredom. Vote Now at http://www.sourceforge.net/community/cca08___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users