#446 closed defect (fixed)
Saving plot as PGF (not PDF!) format throws error
Reported by: | smk78 | Owned by: | |
---|---|---|---|
Priority: | critical | Milestone: | SasView 4.2.0 |
Component: | SasView | Keywords: | |
Cc: | Work Package: | SasView Bug Fixing |
Description
Win 7 Version 3.1.0 Builds 121 & 124 onwards
Attempting to save a plot as PGF (Progressive Graphics File) format results in a file header being created (see attachment) but then the operation fails nicely with the popup message:
Matplotlib backend_wx error. Error starting process xelatex
NB: This needs testing by someone who has Latex installed.
Attachments (1)
Change History (10)
Changed 9 years ago by smk78
comment:1 Changed 8 years ago by krzywon
Here is some documentation on using tex within matplotlib.
A few exceprts from the site that might be relevant:
- Matplotlib’s LaTeX support requires a working LaTeX installation, dvipng (which may be included with your LaTeX installation), and Ghostscript (GPL Ghostscript 8.60 or later is recommended).
- The LaTeX option is activated by setting text.usetex : True in your rc settings.
Example Code for enabling/disabling tex:
from matplotlib import rc rc('text', usetex=True)
comment:2 Changed 8 years ago by lewis
Setting the text.usetex rc option seems to have no effect on the issue.
Matplotlib exports PGF files as a series of Latex commands, which are sent to a latex compiler to produce the image (see http://matplotlib.org/users/pgf.html)
It supports 3 different compilers: xelatex (the default option), lualatex or pdflatex. None of these are included with SasView, hence the error message.
A fix would be to remove the .pgf option from the save image window. However, the save window is managed by matplotlib, so we would have to implement our own.
comment:3 Changed 8 years ago by butler
So does this mean that your system must have one of those compilers installed? Presumably the only reason to create such a latex raw graphic would be because you have latex and want to embed this in your tex document?
If so, perhaps a fix would be to capture the error and pop up a window indicating that "this produces a LaTex command sequence for generating the graphics and requires that one of x, y, z packages be installed none of which are detected on your system - please make sure an appropriate LaTex compiler is installed and try again"
comment:4 Changed 8 years ago by pkienzle
To remove pgf option you can do the following:
from matplotlib import backend_bases
backend_bases._default_filetypes.pop('pgf', None)
This could be put into sasview.py
comment:5 Changed 8 years ago by smk78
Have updated /sasview/src/sas/sasgui/guiframe/media/graph_help.rst to say:
The PGF image type option requires a LaTeX compiler: xelatex (default), lualatex, or pdflatex. These are not shipped with SasView.
comment:6 Changed 8 years ago by Lewis O'Driscoll <lewis.o'drisco
comment:7 Changed 8 years ago by Lewis O'Driscoll <lewis.o'drisco
comment:8 Changed 8 years ago by butler
- Resolution set to fixed
- Status changed from new to closed
This was fixed by Lewis but entering "closes" does not actually close the ticket. Doing so now
comment:9 Changed 7 years ago by butler
- Milestone changed from SasView Next Release +1 to SasView 4.2.0
Example PGF file header that is created