{"id":20399863,"url":"https://github.com/kitware/trame-plotly","last_synced_at":"2025-04-12T13:42:15.451Z","repository":{"id":84741733,"uuid":"490802069","full_name":"Kitware/trame-plotly","owner":"Kitware","description":"trame-plotly brings Plotly charts into trame","archived":false,"fork":false,"pushed_at":"2025-02-11T19:17:58.000Z","size":423,"stargazers_count":3,"open_issues_count":1,"forks_count":0,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-04-12T06:05:09.964Z","etag":null,"topics":["trame","trame-maintenance-program"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Kitware.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.rst","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-05-10T17:43:30.000Z","updated_at":"2025-02-11T19:18:03.000Z","dependencies_parsed_at":"2024-06-18T22:43:47.268Z","dependency_job_id":"61f2e309-0f0c-40cc-9dd6-2d4591376eac","html_url":"https://github.com/Kitware/trame-plotly","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kitware%2Ftrame-plotly","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kitware%2Ftrame-plotly/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kitware%2Ftrame-plotly/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kitware%2Ftrame-plotly/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Kitware","download_url":"https://codeload.github.com/Kitware/trame-plotly/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248525144,"owners_count":21118618,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["trame","trame-maintenance-program"],"created_at":"2024-11-15T04:34:41.022Z","updated_at":"2025-04-12T13:42:15.445Z","avatar_url":"https://github.com/Kitware.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":".. |pypi_download| image:: https://img.shields.io/pypi/dm/trame-plotly\n\nPlotly widget for trame |pypi_download|\n===========================================================================\n\n.. image:: https://github.com/Kitware/trame-plotly/actions/workflows/test_and_release.yml/badge.svg\n    :target: https://github.com/Kitware/trame-plotly/actions/workflows/test_and_release.yml\n    :alt: Test and Release\n\ntrame-plotly extend trame **widgets** with components that can interface with Plotly to display their charts.\n\nPlotly integration in trame allow you to create rich visualization by leveraging their `Python \u003chttps://plotly.com/python/\u003e`_ or `JavaScript \u003chttps://plotly.com/javascript/\u003e`_ interface.\nThe JavaScript version is exposed via `Vue.plotly \u003chttps://david-desmaisons.github.io/vue-plotly/\u003e`_ within trame.widgets.plotly.Plotly class definition.\n\nThis package is not supposed to be used by itself but rather should come as a dependency of **trame**.\nFor any specificity, please refer to `the trame documentation \u003chttps://kitware.github.io/trame/\u003e`_.\n\n\nInstalling\n-----------------------------------------------------------\n\ntrame-plotly can be installed with `pip \u003chttps://pypi.org/project/trame-plotly/\u003e`_:\n\n.. code-block:: bash\n\n    pip install --upgrade trame-plotly\n\nUsage\n-----------------------------------------------------------\n\nThe `Trame Tutorial \u003chttps://kitware.github.io/trame/docs/tutorial.html\u003e`_ is the place to go to learn how to use the library and start building your own application.\n\nThe `API Reference \u003chttps://trame.readthedocs.io/en/latest/index.html\u003e`_ documentation provides API-level documentation.\n\nThe Plotly component relies on the server for generating the chart definition. This can be achieved by hand or by simply using the Python version of Plotly.\n\n\nHow to use it?\n```````````````````````````````````````````````````````````\n\nUsing the Python library\n\n.. code-block:: python\n\n    import plotly.graph_objects as go\n    from trame.widgets import plotly\n\n    fig = go.Figure(\n        data=go.Contour(\n            z=[\n                [10, 10.625, 12.5, 15.625, 20],\n                [5.625, 6.25, 8.125, 11.25, 15.625],\n                [2.5, 3.125, 5.0, 8.125, 12.5],\n                [0.625, 1.25, 3.125, 6.25, 10.625],\n                [0, 0.625, 2.5, 5.625, 10],\n            ]\n        )\n    )\n    fig2 = go.Figure(\n        data=go.Contour(\n            z=[\n                [5.625, 6.25, 8.125, 11.25, 15.625],\n                [2.5, 3.125, 5.0, 8.125, 12.5],\n                [10, 10.625, 12.5, 15.625, 20],\n                [0.625, 1.25, 3.125, 6.25, 10.625],\n                [0, 0.625, 2.5, 5.625, 10],\n            ]\n        )\n    )\n\n    widget = plotly.Figure(fig)\n    widget.update(fig2)\n\nBut if you are feeling more adventurous you can use the component API directly by building the data yourself as well.\n\n.. code-block:: python\n\n    from trame.widgets import plotly\n\n    # https://plotly.com/javascript/reference/\n    plotly_data = [\n      {\n        \"x\": [1,2,3,4],\n        \"y\": [10,15,13,17],\n        \"type\": \"scatter\",\n      }\n    ]\n\n    # https://plotly.com/javascript/reference/layout/\n    plotly_layout = {\n      \"title\": \"My graph\",\n    }\n\n    # https://plotly.com/javascript/configuration-options/\n    plotly_options = {\n      \"scroll_zoom\": True,\n      \"editable\": True,\n      \"static_plot\": True,\n      \"to_image_options\": {\n        \"format\": \"svg\", # one of png, svg, jpeg, webp\n        \"filename\": \"custom_image\",\n        \"height\": 500,\n        \"width\": 700,\n        \"scale\": 1 # Multiply title/legend/axis/canvas sizes by this factor\n      },\n      \"display_mode_bar\": True,\n      \"mode_bar_buttons_to_remove\": [\n        \"zoom2d\", \"pan2d\", \"select2d\", \"lasso2d\", \"zoomIn2d\", \"zoomOut2d\", \"autoScale2d\", \"resetScale2d\", # 2D\n        \"zoom3d\", \"pan3d\", \"orbitRotation\", \"tableRotation\", \"handleDrag3d\", \"resetCameraDefault3d\", \"resetCameraLastSave3d\", \"hoverClosest3d\", # 3D\n        \"hoverClosestCartesian\", \"hoverCompareCartesian\", # Cartesian\n        \"zoomInGeo\", \"zoomOutGeo\", \"resetGeo\", \"hoverClosestGeo\", # Geo\n        \"hoverClosestGl2d\", \"hoverClosestPie\", \"toggleHover\", \"resetViews\", \"toImage\", \"sendDataToCloud\", \"toggleSpikelines\", \"resetViewMapbox\", # Other\n      ],\n      \"mode_bar_buttons_to_add\": [\n        {\n          \"name\": 'color toggler',\n          \"icon\": icon1, # https://plotly.com/javascript/configuration-options/#add-buttons-to-modebar\n          \"click\": \"...\",\n        },\n      ],\n      \"locale\": \"fr\",\n      \"display_logo\": False,\n      \"responsive\": True,\n      \"double_click_delay\": 1000,\n    }\n\n    # Hand made chart\n    chart = plotly.Figure(\n      data=(\"chart_data\", plotly_data),\n      layout=(\"chart_layout\", plotly_layout),\n      **plotly_options,\n    )\n\n\n.. list-table::\n   :widths: 20 80\n   :header-rows: 1\n\n   * - Type\n     - Values\n   * - properties\n     - data, layout, display_mode_bar, scroll_zoom, editable, static_plot, to_image_options, mode_bar_buttons_to_remove, mode_bar_buttons_to_add, locale, display_logo, responsive, double_click_delay\n   * - events\n     - after_export, after_plot, animated, animating_frame, animation_interrupted, auto_size, before_export, button_clicked, click, click_annotation, deselect, double_click, framework, hover, legend_click, legend_double_click, relayout, restyle, redraw, selected, selecting, slider_change, slider_end, slider_start, transitioning, transition_interrupted, unhover\n\n\nLicense\n-----------------------------------------------------------\n\ntrame-plotly is made available under the MIT License. For more details, see `LICENSE \u003chttps://github.com/Kitware/trame-plotly/blob/master/LICENSE\u003e`_\nThis license has been chosen to match the one use by `Plotly \u003chttps://github.com/plotly/plotly.py/blob/master/LICENSE.txt\u003e`_ and `vue-plotly \u003chttps://github.com/David-Desmaisons/vue-plotly/blob/master/LICENSE\u003e`_ which are instrumental for making that library possible.\n\n\nCommunity\n-----------------------------------------------------------\n\n`Trame \u003chttps://kitware.github.io/trame/\u003e`_ | `Discussions \u003chttps://github.com/Kitware/trame/discussions\u003e`_ | `Issues \u003chttps://github.com/Kitware/trame/issues\u003e`_ | `RoadMap \u003chttps://github.com/Kitware/trame/projects/1\u003e`_ | `Contact Us \u003chttps://www.kitware.com/contact-us/\u003e`_\n\n.. image:: https://zenodo.org/badge/410108340.svg\n    :target: https://zenodo.org/badge/latestdoi/410108340\n\n\nEnjoying trame?\n-----------------------------------------------------------\n\nShare your experience `with a testimonial \u003chttps://github.com/Kitware/trame/issues/18\u003e`_ or `with a brand approval \u003chttps://github.com/Kitware/trame/issues/19\u003e`_.\n\n\nJavaScript dependency\n-----------------------------------------------------------\n\nThis Python package bundle the ``plotly.js-dist-min@3.0.0`` JavaScript library. If you would like us to upgrade it, `please reach out \u003chttps://www.kitware.com/trame/\u003e`_.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkitware%2Ftrame-plotly","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkitware%2Ftrame-plotly","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkitware%2Ftrame-plotly/lists"}