Skip to main content

Enhance pandas DataFrame with direct Plotly Express plotting functions

Project description

plotlyplus

Introduction

plotlyplus is a Python module that simplify the calling of plotly.express function. In standard way, one needs to do the following to create a plot using plotly.express based on a dataframe, df, you need to do the following

import pandas as pd
import plotly.express as px

px.scatter(df, x='namex',y='namey')

The plotlyplus package add the plotly.express plotting methods to the pandas dataframe class. This will simply the call to the plotting function as:

from plotlyplus.plotlyplus import *

df.scatter(x='namex',y='namey')

This is a small and almost trivial tweak, but brings a lot of convenience in daily practical work. Enjoy!

Key Features

  • Better integration of plotly.express functions to pandas dataframe: Directly integrates Plotly Express plotting functions with pandas DataFrames.
  • Safe mode: To avoid naming conflicts, plotlyplus introduces a 'safe mode' (plotlyplus_safe). In this mode, each plotly.express function is prefixed with `px_``, ensuring namespace integrity at the cost of slightly reduced convenience.

Installation

Install PlotlyPlus using pip with the following command:

pip install plotlyplus

Usage

Standard Mode

All plotly.express fundtions become methods of pandas dataframe.

from plotlyplus.plotlyplus import *

df = pd.DataFrame(...)
fig = df.bar(...)  # Plotly Express function as a DataFrame method
fig.show()

Safe Mode

This mode prefixes the Plotly Express functions with px_ to minimize namespace conflicts.

from plotlyplus.plotlyplus_safe import *

df = pd.DataFrame(...)
fig = df.px_bar(...)  # Plotly Express function as a DataFrame method
fig.show()

Contributing

Contributions to PlotlyPlus are welcome. Please feel free to submit pull requests, report bugs, or suggest features.

License

PlotlyPlus is made available under the MIT License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

plotlyplus-0.1.1.tar.gz (3.7 kB view hashes)

Uploaded Source

Built Distribution

plotlyplus-0.1.1-py3-none-any.whl (4.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page