astrodash icon indicating copy to clipboard operation
astrodash copied to clipboard

Error when trying to export plot.

Open nicomeza opened this issue 6 years ago • 1 comments

When using the option to save the plot (Export -> Plot -> Image file) the program crashes without saving the plots. The error output :

Traceback (most recent call last): File "/home/dustspeck/miniconda3/lib/python3.7/site-packages/pyqtgraph/exporters/Exporter.py", line 77, in fileSaveFinished self.export(fileName=fileName, **self.fileDialog.opts) File "/home/dustspeck/miniconda3/lib/python3.7/site-packages/pyqtgraph/exporters/ImageExporter.py", line 70, in export bg = np.empty((self.params['width'], self.params['height'], 4), dtype=np.ubyte)

TypeError: 'float' object cannot be interpreted as an integer

When trying to export with the option 'Matplotlib Window' it also crashes.

Error output :


Traceback (most recent call last): File "/home/dustspeck/miniconda3/lib/python3.7/site-packages/pyqtgraph/GraphicsScene/exportDialog.py", line 132, in exportClicked self.currentExporter.export() File "/home/dustspeck/miniconda3/lib/python3.7/site-packages/pyqtgraph/exporters/Matplotlib.py", line 109, in export raise Exception("Matplotlib export currently only works with plot items") Exception: Matplotlib export currently only works with plot items

When selecting the 'Entire scene' instead of 'Plot', saving in image format and SVG seems to work fine.

nicomeza avatar Jan 20 '20 19:01 nicomeza

Thank you for making me aware of this error and for suggesting a workaround. I will try to release a fix to this and add a save_plot routine in the next update. For now, the following should work as you suggest:

To save a plot: Right-click the plot, click Export, select Entire Scene, select Image File or SVG, and save the plot appropriately.

To save the data from the plot: Right-click the plot, click Export, select CSV from plot data, and save the data appropriately.

Of course, you can make your own plots with the saved data, or using the python interface.

daniel-muthukrishna avatar Jan 23 '20 18:01 daniel-muthukrishna