(self, fig_dict)
| 823 | |
| 824 | class SphinxGalleryOrcaRenderer(ExternalRenderer): |
| 825 | def render(self, fig_dict): |
| 826 | stack = inspect.stack() |
| 827 | # Name of script from which plot function was called is retrieved |
| 828 | try: |
| 829 | filename = stack[3].filename # let's hope this is robust... |
| 830 | except Exception: # python 2 |
| 831 | filename = stack[3][1] |
| 832 | filename_root, _ = os.path.splitext(filename) |
| 833 | filename_html = filename_root + ".html" |
| 834 | filename_png = filename_root + ".png" |
| 835 | figure = return_figure_from_figure_or_data(fig_dict, True) |
| 836 | _ = write_html(fig_dict, file=filename_html, include_plotlyjs="cdn") |
| 837 | try: |
| 838 | write_image(figure, filename_png) |
| 839 | except (ValueError, ImportError): |
| 840 | raise ImportError( |
| 841 | "orca and psutil are required to use the `sphinx-gallery-orca` renderer. " |
| 842 | "See https://plotly.com/python/static-image-export/ for instructions on " |
| 843 | "how to install orca. Alternatively, you can use the `sphinx-gallery` " |
| 844 | "renderer (note that png thumbnails can only be generated with " |
| 845 | "the `sphinx-gallery-orca` renderer)." |
| 846 | ) |
nothing calls this directly
no test coverage detected