René's URL Explorer Experiment


Title: plotly.io.renderer proposal · Issue #1459 · plotly/plotly.py · GitHub

Open Graph Title: plotly.io.renderer proposal · Issue #1459 · plotly/plotly.py

X Title: plotly.io.renderer proposal · Issue #1459 · plotly/plotly.py

Description: Overview This issue is a design proposal for a new renderer abstraction for plotly.py to replace the iplot functions. Goals Several goals motivate this work Make it possible to support new plot rendering contexts like static images, rend...

Open Graph Description: Overview This issue is a design proposal for a new renderer abstraction for plotly.py to replace the iplot functions. Goals Several goals motivate this work Make it possible to support new plot ren...

X Description: Overview This issue is a design proposal for a new renderer abstraction for plotly.py to replace the iplot functions. Goals Several goals motivate this work Make it possible to support new plot ren...

Opengraph URL: https://github.com/plotly/plotly.py/issues/1459

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"plotly.io.renderer proposal","articleBody":"## Overview\r\nThis issue is a design proposal for a new renderer abstraction for plotly.py to replace the `iplot` functions.\r\n\r\n## Goals\r\nSeveral goals motivate this work\r\n\r\n 1. Make it possible to support new plot rendering contexts like static images, rendering inside colab, and rendering in popup windows.\r\n 2. Remove the \"offline\" language from plot rendering. As discussed in the [v4 plans](https://github.com/plotly/plotly.py/issues/1420), the Chart Studio integration (the `plotly.plotly` stuff) will be split off into a separate package for v4, and the remaining `plotly` package will be only \"offline\" only.  So having the \"offline\" language will be unnecessary and potentially confusing.\r\n 3. Provide a single location to change the plot rendering approach across an entire notebook.  This will make it much easier for folks to copy/paste documentation examples and change the example to their preferred rendering approach.\r\n\r\n## Background\r\nThere are currently 2 ways to display plots in plotly.py in \"offline\" mode:\r\n\r\n 1. `plotly.offline.iplot`:  This will display plots inline in a Jupyter Notebook or in JupyterLab. The use in the classic notebook requires calling `plotly.offline.init_notebook_mode()` to initialize the notebook before rendering.  The use in JupyterLab requires the [`@jupyterlab/plotly-extension`](https://github.com/jupyterlab/jupyter-renderers/tree/master/packages/plotly-extension)\r\n 2. `plotly.offline.plot`:  This will save the plot to a standalone HTML file and, by default, open it in the default system web browser.\r\n\r\n## Design Influences\r\nThis design is somewhat inspired by the approach used by the Altair project (https://altair-viz.github.io/user_guide/renderers.html), and I expect the Altair implementation will be very helpful reference during the implementation phase of this effort.\r\n\r\nThe design also draws on elements of the `plotly.io.templates` design (See https://github.com/plotly/plotly.py/pull/1224), and is intended to have a consistent user experience.\r\n\r\n## API\r\n\r\n### Default renderer\r\nI propose we add a new configuration object named `renderers` in the `plotly.io` module.  This will sit alongside the `plotly.io.templates` and `plotly.io.orca` configuration objects.  Users will view and specify the current default renderer using property assignment. For example, to specify the equivalent of `plotly.offline.iplot`:\r\n\r\n```python\r\nimport plotly.io as pio\r\npio.renderers.default = 'notebook'  # `init_notebook_mode` and output with `iplot`\r\n```\r\nHere are some other [`mimetype-based.`](https://jupyter.readthedocs.io/en/latest/reference/mimetype.html) renderer options\r\n\r\n```python\r\npio.renderers.default = 'notebook_connected'\r\npio.renderers.default = 'plotly_mimetype'  # Render using plotly mimetype\r\npio.renderers.default = 'jupyterlab' # Same as 'default'\r\npio.renderers.default = 'nteract'  # Same as 'default'\r\npio.renderers.default = 'kaggle'  # Same as 'notebook'\r\npio.renderers.default = 'colab'  # New\r\npio.renderers.default = 'png'  # Init orca server and output as png\r\npio.renderers.default = 'svg'  # Init orca server and output as svg\r\npio.renderers.default = 'pdf'  # Init orca server and output as pdf\r\n```\r\nIn addition to the mime type based renderers for use in a Jupyter context, we can support additional renderers that display figures externally (not inline).  For example\r\n\r\n```python\r\npio.renderers.default = 'browser' # Popup in local default browser tab like plotly.offline.plot\r\npio.renderers.default = 'chrome' # Popup in local chrome tab like plotly.offline.plot\r\npio.renderers.default = 'firefox' # Popup in local firefox tab like plotly.offline.plot\r\npio.renderers.default = 'qtwindow' # (someday) Popup interactive figure in a pyqt browser\r\n```\r\n\r\n### Combining renderers\r\nMultiple renderers can be registered as the default by separating the renderer names with `'+'` characters.  This is the same combination syntax used to combine templates in `plotly.io.templates`. When multiple mime type renderers are specified this way, a single bundle will be created with the render representation for each one.  As motivation, consider\r\n\r\n```python\r\npio.renderers.default = 'notebook+jupyterlab+png'\r\n```\r\nA notebook with this renderer specification would display figures properly in the classic notebook ('notebook'), in jupyterlab ('jupyterlab'), in exported HTML ('notebook'), in the QtConsole/PyCharm ('png'), and in exported PDFs ('png').\r\n\r\nOf course this would result in fairly large notebook sizes, but the user will have the flexibility to define where this code needs to render figures.\r\n\r\n### repr and show\r\nThere will be two ways to display figures.  If one or more mime-type based renderers are defined and the `plotly.io.renderers.render_on_display` property is set to `True`, then the `go.Figure` instances will display themself automatically as their notebook representation.  If `plotly.io.renderers.render_on_display` is set to `False`, then mimetype based rendering will not be performed when figures are displayed.\r\n\r\nIn addition, all renderer types (including external renderers) can be invokes using a new `plotly.io.show` function.  This function will display the figure as a side effect and will return `None`.\r\n\r\nThe `show` functions will also allow the user to override the default renderer. e.g.\r\n```python\r\nimport plotly.io as pio\r\npio.renderers.default = 'notebook'  # `init_notebook_mode` and output with `iplot`\r\n\r\nfig = go.Figure(...)\r\n\r\n# By default show will display figure inline, override to display in browser tab\r\npio.show(fig, renderer='browser')\r\n```\r\n\r\n### Customize renderer properties\r\nSome renderers may need to expose additional configuration options. In this case the default renderer can be specified as an instance of the corresponding class. Each built-in renderer will be defined by a class accessible under `plotly.io.renderers`.\r\n\r\nE.g. to specify a static image renderer with custom properties:\r\n\r\n```python\r\nimport plotly.io as pio\r\npio.renderers['my_png'] = pio.renderers.PngRenderer(width=1000, height=650, scale=1.5)\r\npio.renderers.default = 'my_png'\r\n```\r\n\r\nOr the properties of an existing renderer can be modified directly:\r\n```python\r\npio.renderers['png'].width = 1000\r\npio.renderers['png'].height = 650\r\npio.renderers['png'].scale = 1.5\r\npio.renderers.default = 'png'\r\n```\r\nOr the properties can be overridden temporarily in `plotly.io.show`:\r\n```python\r\npio.show(fig, renderer='png', width=1000, height=650, scale=1.5)\r\n```\r\n\r\n### Registering new renderers\r\nUsers or third-party-libraries may register new renderers by implementing a class following a TBD interface.  \r\n\r\n```python\r\nimport plotly.io as pio\r\n\r\n# Define custom mimetype renderer\r\nclass MyRenderer(pio.base_renderers.MimetypeRenderer):\r\n    ...\r\n    def activate():\r\n        ...\r\n\r\n    def to_mimebundle(self, fig_dict):\r\n        ...\r\n\r\n# Register for use by name\r\nmy_renderer = MyRenderer()\r\npio.renderers['my_renderer'] = my_renderer\r\n\r\n# Set as default\r\npio.renderers.default = 'my_renderer'\r\n```\r\n\r\n### Backward compatibility\r\nFor backward compatibility, `plotly.offline.init_notebook_mode` and `plotly.offline.iplot` will stay around, but they will be implemented on top of the new renderer framework.\r\n\r\nFor plotly.py v3 the default renderer will be `plotly_mimetype` and `iplot` will call `plotly.io.show`.  Calling `plotly.offline.init_notebook_mode()` will set the default renderer to `'plotly_mimetype+notebook'` and `plotly.offline.init_notebook_mode(connected=True)` will set the default renderer to `'plotly_mimetype+notebook_connected'.`\r\n\r\ncc @nicolaskruchten @chriddyp @jackparmer \r\n","author":{"url":"https://github.com/jonmmease","@type":"Person","name":"jonmmease"},"datePublished":"2019-03-11T10:59:08.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":6},"url":"https://github.com/1459/plotly.py/issues/1459"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:83e88a91-929e-ae07-8eca-7793fefb99b1
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idBB30:9AC99:196A1D:241C1A:6A572260
html-safe-nonceccdd3ece4acad5853eea46ed7a14eb760d2351de469a75e689b822af9c6dd7f0
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCQjMwOjlBQzk5OjE5NkExRDoyNDFDMUE6NkE1NzIyNjAiLCJ2aXNpdG9yX2lkIjoiMjQxMTE0MTk1NTM5NDY3NTI5NyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac0ec089ab0f369a9e4773ff1351ff84c77e5a590000f09bf98256f87493f901c7
hovercard-subject-tagissue:419409456
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/plotly/plotly.py/1459/issue_layout
twitter:imagehttps://opengraph.githubassets.com/94492d9cc5facee46cd06916f0885b92127b663572037d1bd443c29e2c5d4936/plotly/plotly.py/issues/1459
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/94492d9cc5facee46cd06916f0885b92127b663572037d1bd443c29e2c5d4936/plotly/plotly.py/issues/1459
og:image:altOverview This issue is a design proposal for a new renderer abstraction for plotly.py to replace the iplot functions. Goals Several goals motivate this work Make it possible to support new plot ren...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamejonmmease
hostnamegithub.com
expected-hostnamegithub.com
None4e7a7296a3830877cf21a6ad2a972c9e618a48915e03966cf0c53eb08e5aad98
turbo-cache-controlno-preview
go-importgithub.com/plotly/plotly.py git https://github.com/plotly/plotly.py.git
octolytics-dimension-user_id5997976
octolytics-dimension-user_loginplotly
octolytics-dimension-repository_id14579099
octolytics-dimension-repository_nwoplotly/plotly.py
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id14579099
octolytics-dimension-repository_network_root_nwoplotly/plotly.py
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release2576d1f0198cf1588faf2edf27f1ed120903be10
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/plotly/plotly.py/issues/1459#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fplotly%2Fplotly.py%2Fissues%2F1459
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/open-source/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/open-source/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fplotly%2Fplotly.py%2Fissues%2F1459
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=plotly%2Fplotly.py
Reloadhttps://github.com/plotly/plotly.py/issues/1459
Reloadhttps://github.com/plotly/plotly.py/issues/1459
Reloadhttps://github.com/plotly/plotly.py/issues/1459
Please reload this pagehttps://github.com/plotly/plotly.py/issues/1459
plotly https://github.com/plotly
plotly.pyhttps://github.com/plotly/plotly.py
Please reload this pagehttps://github.com/plotly/plotly.py/issues/1459
Notifications https://github.com/login?return_to=%2Fplotly%2Fplotly.py
Fork 2.8k https://github.com/login?return_to=%2Fplotly%2Fplotly.py
Star 18.7k https://github.com/login?return_to=%2Fplotly%2Fplotly.py
Code https://github.com/plotly/plotly.py
Issues 721 https://github.com/plotly/plotly.py/issues
Pull requests 54 https://github.com/plotly/plotly.py/pulls
Actions https://github.com/plotly/plotly.py/actions
Security and quality 0 https://github.com/plotly/plotly.py/security
Insights https://github.com/plotly/plotly.py/pulse
Code https://github.com/plotly/plotly.py
Issues https://github.com/plotly/plotly.py/issues
Pull requests https://github.com/plotly/plotly.py/pulls
Actions https://github.com/plotly/plotly.py/actions
Security and quality https://github.com/plotly/plotly.py/security
Insights https://github.com/plotly/plotly.py/pulse
plotly.io.renderer proposalhttps://github.com/plotly/plotly.py/issues/1459#top
https://github.com/jonmmease
jonmmeasehttps://github.com/jonmmease
on Mar 11, 2019https://github.com/plotly/plotly.py/issues/1459#issue-419409456
v4 planshttps://github.com/plotly/plotly.py/issues/1420
@jupyterlab/plotly-extensionhttps://github.com/jupyterlab/jupyter-renderers/tree/master/packages/plotly-extension
https://altair-viz.github.io/user_guide/renderers.htmlhttps://altair-viz.github.io/user_guide/renderers.html
#1224https://github.com/plotly/plotly.py/pull/1224
mimetype-based.https://jupyter.readthedocs.io/en/latest/reference/mimetype.html
@nicolaskruchtenhttps://github.com/nicolaskruchten
@chriddyphttps://github.com/chriddyp
@jackparmerhttps://github.com/jackparmer
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.