{"id":3741,"library":"plotly-express","title":"Plotly Express","description":"Plotly Express (often imported as `px`) is a high-level Python visualization library, designed as a terse, consistent, and easy-to-learn wrapper for Plotly.py. It simplifies the creation of interactive charts with single-function calls, offering over 30 functions for various plot types, including statistical, scientific, and geographical charts. While `plotly-express` on PyPI is at version 0.4.1, the core functionality is now a built-in module, `plotly.express`, within the main `plotly` library (version 6.x.x+), which is actively developed and maintained.","status":"active","version":"0.4.1","language":"en","source_language":"en","source_url":"https://github.com/plotly/plotly.py","tags":["data visualization","plotting","interactive","charts","graphing","plotly"],"install":[{"cmd":"pip install plotly-express","lang":"bash","label":"Install plotly-express (re-exports plotly.express)"},{"cmd":"pip install plotly","lang":"bash","label":"Install main Plotly library (includes plotly.express)"}],"dependencies":[{"reason":"Plotly Express is now a built-in module within the main Plotly library, `plotly.express`. The `plotly-express` package on PyPI primarily re-exports this functionality.","package":"plotly","optional":false},{"reason":"Commonly used for data handling with Plotly Express functions, which are optimized for DataFrames.","package":"pandas","optional":true}],"imports":[{"symbol":"plotly.express","correct":"import plotly.express as px"}],"quickstart":{"code":"import plotly.express as px\nimport pandas as pd\n\n# Use a built-in dataset for a quick example\ndf = px.data.iris()\n\n# Create a scatter plot\nfig = px.scatter(df, x=\"sepal_width\", y=\"sepal_length\", color=\"species\", title=\"Iris Sepal Width vs Length\")\n\n# Display the figure\nfig.show()","lang":"python","description":"This quickstart demonstrates how to import `plotly.express`, load a sample dataset, create a basic scatter plot with colored data points based on a category, and display the interactive figure."},"warnings":[{"fix":"Prefer `import plotly.express as px` after `pip install plotly`. The `plotly-express` package serves mostly for backward compatibility or explicit clarity.","message":"The standalone `plotly-express` PyPI package (version 0.4.1) is now largely a wrapper that re-exports `plotly.express`, which is a module built directly into the main `plotly` library (versions 4.0 and higher). Users typically install `plotly` directly to get `plotly.express`.","severity":"gotcha","affected_versions":"All versions of plotly-express (0.4.1 and earlier), and plotly (4.0+)"},{"fix":"Migrate to Maplibre-based traces such as `scatter_map`, `line_map`, `choropleth_map`, and `density_map` which offer similar functionality without Mapbox dependency.","message":"Mapbox-based traces (`scatter_mapbox`, `line_mapbox`, `choropleth_mapbox`, `density_mapbox`) are deprecated in `plotly.py` version 6 and will be removed in a future release. They rely on Mapbox tokens and are being replaced.","severity":"deprecated","affected_versions":"plotly>=6.0.0"},{"fix":"Rewrite data manipulation logic using pandas, polars, or other dataframe libraries before passing data to Plotly Express functions.","message":"Transforms, which were deprecated in `plotly.py` v5, have been completely removed in `plotly.py` v6. Functionality previously achieved with transforms must now be handled by preprocessing data with a dataframe library.","severity":"breaking","affected_versions":"plotly>=6.0.0"},{"fix":"Update your code to use the new nested title attributes: `layout.title.font`, `layout.title.position`, `layout.title.side`, and `layout.title.offset`.","message":"Several layout attributes for titles (`titlefont`, `titleposition`, `titleside`, `titleoffset`) have been removed in `plotly.py` v6. These were part of the older layout structure.","severity":"breaking","affected_versions":"plotly>=6.0.0"},{"fix":"For optimal use and to leverage parameters like `color`, `facet_row`, `animation_frame`, etc., it's often best to transform wide-form data into long-form using methods like `df.melt()` from pandas.","message":"Plotly Express functions are primarily designed for 'tidy' or long-form dataframes. While some 2D Cartesian functions support wide-form data, using wide-form data may not expose all of Plotly Express's flexible parameter mapping capabilities.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Start with Plotly Express for initial exploration. If specific customizations are not available, you can obtain the figure object from Plotly Express (e.g., `fig = px.scatter(...)`) and then modify it using `fig.update_layout()` or by adding `plotly.graph_objects` traces.","message":"While Plotly Express offers a high-level API for rapid plotting, it provides less fine-grained control over every plot detail compared to `plotly.graph_objects`. For highly customized or complex interactive figures, direct use of `plotly.graph_objects` might be necessary.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}