{"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":"python","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,"search_vec":"'0.4.1':65 '30':44 '6':83 'activ':87 'built':73 'built-in':72 'call':41 'chart':36,55,95 'consist':21 'core':67 'creation':33 'data':91 'design':17 'develop':88 'easi':24 'easy-to-learn':23 'express':2,4,59 'function':40,45,68 'geograph':54 'graph':96 'high':12 'high-level':11 'import':6 'includ':50 'interact':35,94 'learn':26 'level':13 'librari':16,81 'main':79 'maintain':90 'modul':75 'offer':42 'often':5 'plot':1,3,48,58,80,93,97 'plotly-express':57 'plotly.express':76 'plotly.py':29 'px':8 'pypi':61 'python':14 'scientif':52 'simplifi':31 'singl':39 'single-funct':38 'statist':51 'ters':20 'type':49 'various':47 'version':64,82 'visual':15,92 'within':77 'wrapper':27 'x.x':84","created_at":"2026-04-11T17:42:44.286364+00:00","updated_at":"2026-04-16T18:04:02.168192+00:00","problems":[{"fix":"Ensure `plotly` is installed and up-to-date in your active Python environment: `pip install --upgrade plotly`. If your script is named `plotly.py`, rename it.","cause":"The `plotly.express` module is not found, often because the `plotly` library is not installed, is installed in a different environment, or is an older version (pre-4.0) that did not include `plotly.express` as a built-in module. It can also happen if your script is named `plotly.py`, shadowing the actual library.","error":"ModuleNotFoundError: No module named 'plotly.express'"},{"fix":"Add `import plotly.express as px` at the beginning of your script or notebook cell before using `px` functions.","cause":"This error occurs when `plotly.express` functions are called using the `px` alias without first importing the module as `import plotly.express as px`.","error":"NameError: name 'px' is not defined"},{"fix":"Upgrade your `plotly` library to the latest version: `pip install --upgrade plotly`. Also, uninstall the older `plotly-express` standalone package if it's present: `pip uninstall plotly-express`.","cause":"This typically means the installed `plotly` library version is too old (prior to version 4.0) to contain the `express` submodule. The standalone `plotly-express` package (version 0.4.1) was integrated into the main `plotly` library as `plotly.express` starting with `plotly` version 4.0.","error":"AttributeError: module 'plotly' has no attribute 'express'"},{"fix":"Upgrade your `plotly` library to the latest version to access newer functions: `pip install --upgrade plotly`. If the attribute is `Constant`, it's likely a misunderstanding as `px.Constant` does not exist; check the Plotly Express documentation for the correct way to achieve your goal.","cause":"You are attempting to use a function or attribute (like `px.timeline` or `px.imshow`) that was introduced in a newer version of `plotly.express` than what you currently have installed, or it doesn't exist.","error":"AttributeError: module 'plotly.express' has no attribute 'some_function' (e.g., 'timeline', 'imshow', 'Constant')"},{"fix":"Install the `pandas` library: `pip install pandas`.","cause":"`plotly.express` relies on the `pandas` library for data handling, and this error indicates that `pandas` is not installed in your Python environment.","error":"ImportError: Plotly express requires pandas to be installed."}],"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"0.4.1","cli_name":"","cli_version":null,"type":"library","homepage":"https://plotly.express/","github":"https://github.com/plotly/plotly_express","docs":null,"changelog":null,"pypi":"https://pypi.org/project/plotly-express/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["data","ai-ml"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-28","last_verified":"2026-08-29","next_check":"2026-07-28","install_tag":null}}