From: <and...@ti...> - 2005-03-06 14:53:43
|
Hello NG, I am trying to plot a series of point (in a wxPython window). Everyth= ing works if I plot all the points together, as: myreference =3D plot(x, y, 'ko') But I would like to plot 1 point at a time, and to keep a "plot reference= " of every point, because I will have to be able to interact with every sin= gle point (and not with all of them) separately, using the mpl_connect functi= ons. If I try to plot a single point, matplotlib/pylab returns me an error lik= e: File "D:\MyProjects\globall\SummaryPanel.py", line 169, in CreateWellMa= p mp =3D axdata.plot(xc[cc], yc[cc], "ko") File "C:\Python23\Lib\site-packages\matplotlib\axes.py", line 2324, in plot for line in self._get_lines(*args, **kwargs): File "C:\Python23\Lib\site-packages\matplotlib\axes.py", line 276, in _grab_ne xt_args yield self._plot_3_args(remaining, **kwargs) File "C:\Python23\Lib\site-packages\matplotlib\axes.py", line 238, in _plot_3_ args assert(iterable(x)) AssertionError Does anyone have a suggestion? Thank you very much. Andrea. |
From: Eli G. <eg...@se...> - 2005-03-07 15:37:17
|
Hello all, First let me say how much I appreciate matplotlib and the matplotlib community. I currently have a wxPython application which embeds a matplotlib window using the WXAgg backend. I use this application to generate plots based on some simple user inputs. After I get the plot looking the way I like, I have a "Save Plot" button which basically calls self.canvas.print_figure(filename,...). This works great for saving to JPG and PNG format. What I'd like to do is be able to save to PS or EPS format. Is this possible? It seems like there is an switch_backend() function which might be of help. Before I go down that route, I'd like to know if it is possible to use the WXAgg backend for normal plotting to the screen and then switch_backend(PS), redraw the plot, save using print_figure() or savefig() to a *.ps file, and then switch_backend(WXAgg) to resume interactive plotting on the screen. Thanks, Eli |
From: Darren D. <dd...@co...> - 2005-03-07 16:20:39
|
Hi Eli, Have you tried simply calling savefig('file.eps')? You shouldnt need to worry about switching backends. Darren On Monday 07 March 2005 10:37 am, Eli Glaser wrote: > Hello all, > > First let me say how much I appreciate matplotlib and the matplotlib > community. > > I currently have a wxPython application which embeds a matplotlib window > using the WXAgg backend. I use this > application to generate plots based on some simple user inputs. After I > get the plot looking the way I like, I have > a "Save Plot" button which basically calls > self.canvas.print_figure(filename,...). This works great for saving to > JPG and PNG format. What I'd like to do is be able to save to PS or EPS > format. Is this possible? > > It seems like there is an switch_backend() function which might be of help. > Before I go down that route, I'd like to know > if it is possible to use the WXAgg backend for normal plotting to the > screen and then switch_backend(PS), redraw the > plot, save using print_figure() or savefig() to a *.ps file, and then > switch_backend(WXAgg) to resume interactive > plotting on the screen. > > Thanks, > > Eli > > > > > > ------------------------------------------------------- > SF email is sponsored by - The IT Product Guide > Read honest & candid reviews on hundreds of IT Products from real users. > Discover which products truly live up to the hype. Start reading now. > http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Darren |
From: Eli G. <eg...@se...> - 2005-03-07 16:36:14
|
Darren, It was my impression that savefig() only supports jpeg and png format. From the docs: http://matplotlib.sourceforge.net/matplotlib.pylab.html#-savefig savefig(*args, **kwargs) SAVEFIG(fname, dpi=150, facecolor='w', edgecolor='w', orientation='portrait'): Save the current figure to filename fname. dpi is the resolution in dots per inch. Output file types currently supported are jpeg and png and will be deduced by the extension to fname Also I guess I'm not clear if saving to PS/EPS format actually creates a line drawing/ vector image or just creates a bitmap and encapsulates the bitmap in the PS/EPS format. I'm looking to be able to save as a line drawing or vector-type format. Thanks, Eli ----- Original Message ----- From: "Darren Dale" <dd...@co...> To: <mat...@li...> Sent: Monday, March 07, 2005 10:52 AM Subject: Re: [Matplotlib-users] PS Output from WXAGG / wxPython application > Hi Eli, > > Have you tried simply calling savefig('file.eps')? You shouldnt need to > worry > about switching backends. > > Darren > > > On Monday 07 March 2005 10:37 am, Eli Glaser wrote: >> Hello all, >> >> First let me say how much I appreciate matplotlib and the matplotlib >> community. >> >> I currently have a wxPython application which embeds a matplotlib window >> using the WXAgg backend. I use this >> application to generate plots based on some simple user inputs. After I >> get the plot looking the way I like, I have >> a "Save Plot" button which basically calls >> self.canvas.print_figure(filename,...). This works great for saving to >> JPG and PNG format. What I'd like to do is be able to save to PS or EPS >> format. Is this possible? >> >> It seems like there is an switch_backend() function which might be of >> help. >> Before I go down that route, I'd like to know >> if it is possible to use the WXAgg backend for normal plotting to the >> screen and then switch_backend(PS), redraw the >> plot, save using print_figure() or savefig() to a *.ps file, and then >> switch_backend(WXAgg) to resume interactive >> plotting on the screen. >> >> Thanks, >> >> Eli >> >> >> >> >> >> ------------------------------------------------------- >> SF email is sponsored by - The IT Product Guide >> Read honest & candid reviews on hundreds of IT Products from real users. >> Discover which products truly live up to the hype. Start reading now. >> http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click >> _______________________________________________ >> Matplotlib-users mailing list >> Mat...@li... >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > -- > > Darren > > > ------------------------------------------------------- > SF email is sponsored by - The IT Product Guide > Read honest & candid reviews on hundreds of IT Products from real users. > Discover which products truly live up to the hype. Start reading now. > http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > |
From: Darren D. <dd...@co...> - 2005-03-07 16:54:21
|
On Monday 07 March 2005 11:36 am, Eli Glaser wrote: > Darren, > > It was my impression that savefig() only supports jpeg and png format. > > From the docs: > http://matplotlib.sourceforge.net/matplotlib.pylab.html#-savefig > > savefig(*args, **kwargs) > SAVEFIG(fname, dpi=150, facecolor='w', edgecolor='w', > orientation='portrait'): > > Save the current figure to filename fname. dpi is the resolution > in dots per inch. > > Output file types currently supported are jpeg and png and will be > deduced by the extension to fname I agree that is a little misleading, but keep reading: orientation is either 'landscape' or 'portrait' - not supported on all backends; currently only on postscript output. savefig works for ps and eps, I use it all the time without changing backends. > > > Also I guess I'm not clear if saving to PS/EPS format actually creates a > line drawing/ vector image or > just creates a bitmap and encapsulates the bitmap in the PS/EPS format. > I'm looking to > be able to save as a line drawing or vector-type format. I dont think it is a bitmap, but I will let someone more knowledgable speak to that. -- Darren |
From: Eli G. <eg...@se...> - 2005-03-07 19:32:03
|
>> savefig(*args, **kwargs) >> SAVEFIG(fname, dpi=150, facecolor='w', edgecolor='w', >> orientation='portrait'): >> >> Save the current figure to filename fname. dpi is the resolution >> in dots per inch. >> >> Output file types currently supported are jpeg and png and will be >> deduced by the extension to fname > > I agree that is a little misleading, but keep reading: > > orientation is either 'landscape' or 'portrait' - not supported on > all backends; currently only on postscript output. > > savefig works for ps and eps, I use it all the time without changing > backends. > Ok I tried that out and I am able to save ps files without doing any backend switching. Thanks for the tip! >> Also I guess I'm not clear if saving to PS/EPS format actually creates a >> line drawing/ vector image or >> just creates a bitmap and encapsulates the bitmap in the PS/EPS format. >> I'm looking to >> be able to save as a line drawing or vector-type format. > > I dont think it is a bitmap, but I will let someone more knowledgable > speak to > that. Can anyone confirm or deny this? It seems to me that it is saving out in a rasterized version encapsulated in the postscript format. I tried saving a simple plot in both PNG and PS format - the PNG is 77 kb and the PS is 623 kb. The plot only has 3 curves and a legend so I'm guessing its being rasterized in the PS format. I guess my real question is: is it possible to save a matplotlib plot in a vector-based format? Thanks, Eli |
From: Matt N. <new...@ca...> - 2005-03-07 20:53:28
|
> > I dont think it is a bitmap, but I will let someone more > > knowledgable speak to that. > > Can anyone confirm or deny this? It seems to me that it is > saving out in a rasterized version encapsulated in the > postscript format. I tried saving a simple plot in both PNG > and PS format - the PNG is 77 kb and the PS is 623 kb. The > plot only has 3 curves and a legend so I'm guessing its being > rasterized in the PS format. > > I guess my real question is: is it possible to save a > matplotlib plot in a vector-based format? It does not save a bitmap of the image to a postscript file, but normal postscript commands. The eps file is relatively large (at least compared to png) because it includes a large but fixed amount of font data. Try adding another line to your plot or otherwise changing the contents of the plot, and you'll see size of the eps file change. Cheers, --Matt |
From: Eli G. <eg...@se...> - 2005-03-07 21:37:28
|
> > It does not save a bitmap of the image to a postscript file, but > normal postscript commands. The eps file is relatively large > (at least compared to png) because it includes a large but fixed > amount of font data. Try adding another line to your plot or > otherwise changing the contents of the plot, and you'll see size > of the eps file change. Thanks...Originally I opened up the PS file in a text editor and saw lines of hex data - I assumed it was a raster version of the plot. Now I see that hex data is describing the fonts, and there are standard vector descriptors at the end of the file. Thanks again, Eli |
From: John H. <jdh...@ac...> - 2005-03-09 19:46:21
|
>>>>> "Eli" == Eli Glaser <eg...@se...> writes: Eli> Thanks...Originally I opened up the PS file in a text editor Eli> and saw lines of hex data - I assumed it was a raster version Eli> of the plot. Now I see that hex data is describing the Eli> fonts, and there are standard vector descriptors at the end Eli> of the file. That's right -- to support mathtext and font compatibility between the raster formats and ps output, we embed the truetype font information directly into the file. Unfortunately, we haven't yet succeeded in getting just the characters we need embedded in the file, and have to dump the whole font file. We have a couple of approaches to fix this, and so the file size issue should get better in future releases. The only rasters we embed in postscript are images you create with imshow or figimage -- everything else is vector graphics. JDH |
From: Norm P. <nj...@nj...> - 2005-03-08 14:59:22
|
> > I guess my real question is: is it possible to save a matplotlib plot > in a vector-based format? > Sure, saving as ".svg" works just fine for me... > Thanks, > > Eli > > > > > ------------------------------------------------------- > SF email is sponsored by - The IT Product Guide > Read honest & candid reviews on hundreds of IT Products from real users. > Discover which products truly live up to the hype. Start reading now. > http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > |