PROC R writes image outputs to ODS destinations, but PROC PYTHON appears not to!
When I am using an ODS destination, such as ODS HTML, ODS RTF or ODS PDF, PROC R writes all output (including images) to that destination with no additional R code required.
However, when I am using an ODS destination, such as ODS HTML, ODS RTF or ODS PDF, PROC PYTHON will print to the ODS destination, but images can only be sent directly to the browser or to an image file specified in the Python code.
Why do PROC R and PROC PYTHON behave so differently?
So far PROC PYTHON has been tested with the following plotting packages:
- plotly.express
- matplotlib.pyplot and seaborn
Should I be using a specific Python package that behaves with ODS destinations?...............Phil
Answers
-
I have found a solution to this problem: just save the final image using the following location, where wpsgloc is a temporary graphics location for ODS destinations created by PROC PYTHON:
os.path.join(wpsgloc, 'image.png')
Other image formats, such as *.jpeg and *.gif, will work too.
However, although I can now send Python graphics to ODS destinations, this requires an update to my Python code, so it is still different to the behaviour of PROC R!
...........Phil
0