| interactive graphing library for Python sparkles | Data Visualization library

 by   plotly Python Version: v5.15.0 License: MIT

kandi X-RAY | Summary

kandi X-RAY | Summary is a Python library typically used in Analytics, Data Visualization, Jupyter applications. has no bugs, it has no vulnerabilities, it has build file available, it has a Permissive License and it has medium support. You can install using 'pip install' or download it from GitHub, PyPI. is an interactive, open-source, and browser-based graphing library for Python :sparkles:. Built on top of plotly.js, is a high-level, declarative charting library. plotly.js ships with over 30 chart types, including scientific charts, 3D graphs, statistical charts, SVG maps, financial charts, and more. is MIT Licensed. Plotly graphs can be viewed in Jupyter notebooks, standalone HTML files, or hosted online using Chart Studio Cloud. Contact us for consulting, dashboard development, application integration, and feature additions.

            kandi-support Support

     has a medium active ecosystem.
              It has 13630 star(s) with 2368 fork(s). There are 280 watchers for this library.
              There were 3 major release(s) in the last 12 months.
              There are 1297 open issues and 1330 have been closed. On average issues are closed in 68 days. There are 72 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of is v5.15.0

            kandi-Quality Quality

     has 0 bugs and 0 code smells.

            kandi-Security Security

     has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
     code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

     is licensed under the MIT License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

     releases are available to install and integrate.
              Deployable package is available in PyPI.
              Build file is available. You can build the component from source.
              Installation instructions, examples and code snippets are available.
     saves you 879985 person hours of effort in developing the same functionality from scratch.
              It has 454932 lines of code, 32838 functions and 11970 files.
              It has low code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi has reviewed and discovered the below as its top functions. This is intended to give you an instant insight into implemented functionality, and help decide if they suit your requirements.
            • Build matplotlib figure .
            • Add a box to the plot .
            • Creates a scatter plot .
            • Creates a facet grid plot
            • Plot an image .
            • Make a scatterplot plot
            • Add an annotation .
            • returns layout specs
            • Build a source datatype .
            • Convert matplotlib figure to HTML .
            Get all kandi verified functions for this library.

   Key Features

            No Key Features are available at this moment for

   Examples and Code Snippets

            Plotly How to plot multiple lines with different X-arrays on the same Y-axis
            Pythondot img1Lines of Code : 16dot img1License : Strong Copyleft (CC BY-SA 4.0)
            copy iconCopy
            import plotly.graph_objects as go
            x1 = [1, 3, 5, 7, 9]
            y1 = np.random.random(5)
            x2 = [2, 4, 6, 8, 10]
            y2 = np.random.random(5)
            f1 = go.Figure(
                data = [
                    go.Scatter(x=x1, y=y1, name="first"),
                    go.Scatter(x=x2, y=y2, name
            I want to make an animated polar chart but the chart i get only has one radii with a list
            Pythondot img2Lines of Code : 23dot img2License : Strong Copyleft (CC BY-SA 4.0)
            copy iconCopy
            med_spotify = spotify_data.drop(columns=['name', 'explicit', 'artists', 'key', 'mode', 'time_signature', 'tempo', 'duration_ms', 'loudness']) 
            med_spotify = med_spotify.groupby('release_date').median()
            Highlight one specific bar in plotly bar chart [python]
            Pythondot img3Lines of Code : 18dot img3License : Strong Copyleft (CC BY-SA 4.0)
            copy iconCopy
            import as px
            default_color = "blue"
            colors = {"China": "red"}
            data ="year == 1952")
            color_discrete_map = {
                c: colors.get(c, default_color) 
                for c in}
            fig =
            Save plotly figure interactively (html) whilst preserving LaTeX font
            Pythondot img4Lines of Code : 5dot img4License : Strong Copyleft (CC BY-SA 4.0)
            copy iconCopy
            import as px
            fig = px.line(x = [0,1,2], y = [0,1,4])
            fig.update_layout(title=r'$\text{Some title}_2$')
            fig.write_html("example_figure.html", include_mathjax = 'cdn')
            flask app convert sql query to python plotly
            Pythondot img5Lines of Code : 15dot img5License : Strong Copyleft (CC BY-SA 4.0)
            copy iconCopy
            result = query_tickets_status()
            labels_statut = result['status']
            values_statut = result['count_status']
            query_result = pd.read_sql ("""
                    SELECT COUNT(*)count_status, status 
                    FROM tickets 
            Get ClickData from Python Visdcc Network Graph
            Pythondot img6Lines of Code : 24dot img6License : Strong Copyleft (CC BY-SA 4.0)
            copy iconCopy
            app.layout = html.Div([
                  visdcc.Network(id = 'net',
                                 selection = {'nodes':[], 'edges':[]},
                                 options = dict(height= '600px', width= '100%')),
                  html.Div(id = 'nodes'),
                  html.Div(id = 'ed
            Dash ImportError: cannot import name 'get_current_traceback' from 'werkzeug.debug.tbtools'
            Pythondot img7Lines of Code : 4dot img7License : Strong Copyleft (CC BY-SA 4.0)
            copy iconCopy
            pip uninstall werkzeug
            pip install -v
            How to print out Model Summary in Plotly Dash?
            Pythondot img8Lines of Code : 6dot img8License : Strong Copyleft (CC BY-SA 4.0)
            copy iconCopy
            summary = arima.summary()
            app.layout = html.Div([
            Run a Python script in Dash Callback
            Pythondot img9Lines of Code : 17dot img9License : Strong Copyleft (CC BY-SA 4.0)
            copy iconCopy
                Output("modal", "is_open"),
                [Input("open-button", "n_clicks"), Input("close-button", "n_clicks")],
                [State("modal", "is_open")],
            def activate_modal(n1, n2, is_open):
                ctx = dash.callback_context
            Update dashtable columns name dynamically
            Pythondot img10Lines of Code : 36dot img10License : Strong Copyleft (CC BY-SA 4.0)
            copy iconCopy
            def update_columns_name(columns):
                col_name = df2[[columns]]
                df3 = pd.merge(df1, col_name, left_index=True, right_index=True)
                df3 = df3.reset_index()
                mycolumns = [{'name': i, 'id': i} for i in df3.columns]
                return (

            Community Discussions


            How to Show only boundaries (no fill) of a shapefile in python plotly express?
            Asked 2022-Apr-08 at 12:58

            I have a shapefile of areas/polygons and I'm trying to show that in a choropleth_mapbox in plotly express. What I want to show is only the boundaries/borders. i.e. the fill colour is transparent!

            I've been doing something like this:



            Answered 2022-Apr-08 at 12:58

            If all you want are boundary lines, then you can add a geojson layer. Have used other geometry as you geometry is not accessible to me.



            Plotly: How to manually specify the label of an aggregated field in
            Asked 2022-Feb-19 at 12:02

            In histogram and Density heatmaps an aggregation function (histfunc) such as sum or avg may be specified. The x and (unaggregated) y axis labels can be manually specified via the labels dict, but what about the label of the aggregated dimension?

            How can the label of the aggregated dimension be manually specified?



            Answered 2022-Feb-19 at 07:55

            You can use the function update_layout to set y axis label. Example:



            How to draw bounderies between countries and countries' states on pyplot.go.Figure with go.Scattergeo
            Asked 2022-Jan-26 at 14:51

            So, I am doing a map that shows the flow of people among some cities in Brazil by drawing lines on the map, representing the path, and setting its opacity according to the count of occurrences. To do so, I am following this code (third map, the one about flights on US).

            My question is, can I draw the borders between countries? And, if possible, also between Brazilian states?

            In the documentation, there is an argument of the function called "geojson", but I'am not sure on how to use it, or if it is even useful for me.

            Note that I have GeoJSON data for both countries and states.

            Here's the code to generate the my map:



            Answered 2022-Jan-25 at 03:20

            Since I don't have the geojson data and the latitude and longitude information to draw the line, I'll use the official reference you referenced to answer your question.

            • Using the choropleth map, add a sum column with 0 to the data used in this sample.
            • Specify the geojson you obtained to geojson=usa_geo.
            • We associate the geojson state name with the state in the data.
            • I set the map fill to a light gray.
            • Note: The center setting of the map is automatically calculated since we are using fitbounds for the location.



   Sankey Diagrams - Controlling Node Destination
            Asked 2022-Jan-05 at 22:50

            I have a similar issue to a question previously posted:

            Plotly: How to set node positions in a Sankey Diagram?

            ..In which I need to get all my values which end in the same character to align in the same vertical column in my Sankey Diagram (There are three vertical columns in total, and I want (A) in the first, (B) in the second, and (C) in the third). There was an answer to this previous posting providing a custom function to assign nodes ending in the same character to the same destination, which I have modified to fit my dataset, as below:



            Answered 2022-Jan-05 at 22:50
            • you have not provided sample data, so have built a generator matching what you have described
            • it is the case that normalised x and y range needs to be > 0 and < 1
            • have used same approach as in this answer plotly sankey graph data formatting to generate a Sankey from a dataframe



            Plotly express box plot hover data not working
            Asked 2021-Nov-29 at 17:48

            Trying to add data to hover of boxplot express in plotly and following the instructions here in plotly 5.4.1. It is mentioned in the tutorial that additional information to be shown in the hover can be added by hover_data and hover_name argument. However, The additional hover data, in this case information from continent column, is not presented in the hover. I am not sure what is going wrong here? (Here is the code I test in Google colab)



            Answered 2021-Nov-29 at 17:48
            • this is similar to Change Plotly Boxplot Hover Data
            • boxplot hover info is within javascript layer of plotly. Hence have overlayed a bar plot where hover can be controlled in way you require. When you hover over boxplot you get standard boxplot hover. bar different hover info



            How to remove x-axis tick labels in a stacked-and-grouped bar chart using Plotly
            Asked 2021-Aug-10 at 18:01

            I have a dataset:

            I want to visualise this dataset in a stacked-and-grouped bar chart using Plotly. Unfortunately, Plotly does not have this type of charts yet, but there is this workaround that I tried.

            My code:



            Answered 2021-Aug-10 at 18:01



            The property outliercolor of python plotly graph_objects box marker is not working (possible bug)
            Asked 2021-Jul-12 at 01:13

            I think I've found a bug in the class Marker, because the property outliercolor is not working. I followed the reference in, but it wont make any difference to change the outliers color.

            Here is an example:



            Answered 2021-Jul-12 at 01:13

            This does indeed appear to be a bug in Plotly - this can be submitted as a bug report to the Plotly team.

            It is worth noting that modifying boxpoints = "outliers" to boxpoints = "suspectedoutliers" produces markers with a different color so suspectedoutliers behaves as expected. However, you can't use suspectedoutliers in place of outliers as suspected outliers are only a subset of all outliers.

            You can achieve the desired behavior by plotting the outliers manually. To do this, you would still set boxpoints=outliers, but then plot the outliers as individual scatter points with the desired color over the outliers generated by Plotly.

            This is a bit intensive because this requires a rewrite of the algorithm to determine outliers exactly as the Plotly library performs this calculation. And unfortunately, you cannot extract Q1, Q3 or other statistics from go.Box or from Plotly in any way as these computations are performed by the Javascript under the hood when the figure renders.

            The first thing to note is that calculating Q1 and Q3 differs between different Python libraries: Plotly outlines their methods in the documentation, explaining that they use Method #10 in this short paper to calculate percentiles.

            In Python, the function to calculate percentiles using Method #10 (linear interpolation) looks like this:



            Python: Plotly & Dash | Real time graph dcc.Interval, function called twice... bug?
            Asked 2021-May-29 at 11:28

            First post here, I hope you can help me with this weird situation… I’m working on some realtime plotting with plotly (dcc.Interval) and I just find one of the functions I’m using for getting my data is being called twice during the execution. This is very strange as I’m just calling this function once and it’s really messing with my code:



            Answered 2021-May-29 at 11:28

            The code is run twice because you are in debug mode. Set debug=False, and it should execute only once.



            ValueError: Mime type rendering requires nbformat>=4.2.0 but it is not installed
            Asked 2021-Mar-10 at 02:37

            I was trying to print a plotly plot in Visual Studio Code and caught this error:



            Answered 2021-Mar-10 at 02:37

            Method 1.

            reinstall ipykernel via pipenv install ipykernel

            Method 2.



            Is there a way to have add_vline vertical line extend indefinetely on the y axis?
            Asked 2021-Feb-04 at 14:10

            As of plotly version 4.12, you can add Horizontal and Vertical Lines and Rectangles. I have installed plotly 4.12. I am using the following snippet:



            Answered 2021-Feb-04 at 14:10

            The add_vline function uses recently-added features in the underlying rendering engine, Plotly.js, meaning you need a recent version of Plotly.js wherever you are using In practice this means installing the latest jupyterlab-plotly extension in JupyterLab, the latest dash/dash_core_components in Dash, or waiting until VSCode and/or Streamlit update their onboard copies of Plotly.js, if you’re seeing this problem in those environments.

            More information can be found here: Troubleshooting | Python | Plotly


            Community Discussions, Code Snippets contain sources that include Stack Exchange Network


            No vulnerabilities reported


            Inside Jupyter (installable with pip install "jupyterlab>=3" "ipywidgets>=7.6"):. See the Python documentation for more examples. Read about what's new in v4.
   may be installed using pip...


            For use in JupyterLab, install the jupyterlab and ipywidgets packages using pip:.
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
          • HTTPS


          • CLI

            gh repo clone plotly/

          • sshUrl


          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link