MCPcopy Index your code
hub / github.com/plotly/plotly.py / render

Method render

plotly/io/_base_renderers.py:825–846  ·  view source on GitHub ↗
(self, fig_dict)

Source from the content-addressed store, hash-verified

823
824class 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 )

Callers

nothing calls this directly

Calls 3

write_htmlFunction · 0.90
write_imageFunction · 0.90

Tested by

no test coverage detected