I'd like to automatically generate exports of the entire graphics scene from list of files. Searching through the code it looks like the dialog method is all that is implemented. Anybody done this already?
Also are there any plans to implement a .pdf exporter anytime soon?
On Wed, Sep 18, 2013 at 11:02 AM, Richard Smith <smit...@gmail.com> wrote:I'd like to automatically generate exports of the entire graphics scene from list of files. Searching through the code it looks like the dialog method is all that is implemented. Anybody done this already?Does this answer your question?
Also are there any plans to implement a .pdf exporter anytime soon?Not at present--I have not been able to generate acceptable results with Qt's printing functionality.I recommend using inkscape to generate PDF from SVG (this can be automated using inkscape's --export-pdf flag).
On Wednesday, September 18, 2013 11:11:35 AM UTC-4, Luke Campagnola wrote:On Wed, Sep 18, 2013 at 11:02 AM, Richard Smith <smit...@gmail.com> wrote:I'd like to automatically generate exports of the entire graphics scene from list of files. Searching through the code it looks like the dialog method is all that is implemented. Anybody done this already?Does this answer your question?Thanks for the quick response.Not quite because I always get object has no attribute 'plotItem'Here's my code. Following the example in examples/Plotting.py I've done:win = pg.GraphicsWindow()p1 = win.addPlot(title="Data")win.nextRow()p2 = win.addPlot(title="Filter Subtraction")Then I call p1.plot and p2.plot to make the plots.
Exporter isn't happy with either win.plotItem or p1.plotItemAlso are there any plans to implement a .pdf exporter anytime soon?Not at present--I have not been able to generate acceptable results with Qt's printing functionality.I recommend using inkscape to generate PDF from SVG (this can be automated using inkscape's --export-pdf flag).That's odd since I print to .pdf using kde all the time and it seems to be ok. What sort of things are wrong in the output?
On Wed, Sep 18, 2013 at 12:20 PM, Richard Smith <smit...@gmail.com> wrote:
On Wednesday, September 18, 2013 11:11:35 AM UTC-4, Luke Campagnola wrote:On Wed, Sep 18, 2013 at 11:02 AM, Richard Smith <smit...@gmail.com> wrote:I'd like to automatically generate exports of the entire graphics scene from list of files. Searching through the code it looks like the dialog method is all that is implemented. Anybody done this already?Does this answer your question?Thanks for the quick response.Not quite because I always get object has no attribute 'plotItem'Here's my code. Following the example in examples/Plotting.py I've done:win = pg.GraphicsWindow()p1 = win.addPlot(title="Data")win.nextRow()p2 = win.addPlot(title="Filter Subtraction")Then I call p1.plot and p2.plot to make the plots.GraphicsWindow may contain multiple plots / views / etc. so it does not have a plotItem attribute.Instead, you may pass p1 or p2 to the exporter.
There are some examples out there of exporting to pdf. The gets pretty close, but the line becomes much thicker. I don't know if these were similar problems you were encountering, Luke.
GraphicsWindow may contain multiple plots / views / etc. so it does not have a plotItem attribute.Instead, you may pass p1 or p2 to the exporter.Passing p1 or p2 to the exporter results in the following error.ValueError: Buffer size too small (0 instead of at least 1 bytes)
rsmith@thinko:~$ lowpass.py Rich_1_Volts_20130918_155632.xlsTraceback (most recent call last):File "/home/rsmith/bin/lowpass.py", line 203, in <module>process_files(args.filenames,args)File "/home/rsmith/bin/lowpass.py", line 156, in process_filesexporter.export('auto.png')File "/usr/local/lib/python2.7/dist-packages/pyqtgraph/exporters/ImageExporter.py", line 66, in exportself.png = pg.makeQImage(bg, alpha=True)File "/usr/local/lib/python2.7/dist-packages/pyqtgraph/functions.py", line 957, in makeQImageaddr = ctypes.c_char.from_buffer(imgData, 0)ValueError: Buffer size too small (0 instead of at least 1 bytes)
Sure. Attached is chopped version + data file.run it with ./lowpass datafile.txt
Thank you!The problem is that you are trying to export before the window has been initialized by Qt, and thus it has width=0. You can correct this by adding `QtGui.QApplication.processEvents()` immediately before creating the exporter. I will add a more useful error message..I was also able to export the scene object to get both plots in one image. If that is still broken for you, I'd recommend trying the development branch ( git clone g...@github.com:pyqtgraph/pyqtgraph.git develop ) or try the next release when it comes out.