plot a dataframe python code example

Example 1: plot a pandas dataframe matplotlib

import pandas as pd
import matplotlib.pyplot as plt
df = pd.Dataframe(Data)
df.plot(kind='bar',x="dataframe_1",y="dataframe_2") # bar can be replaced by 
# scatter or line or even left as default
plt.show()

Example 2: scatter plot of a dataframe in python

>>> ax2 = df.plot.scatter(x='length',
...                       y='width',
...                       c='species',
...                       colormap='viridis')

Example 3: how to use plotly in python

import plotly.graph_objects as go
fig = go.Figure(data=go.Bar(y=[2, 3, 1]))
fig.show()

Example 4: how to plot a pandas dataframe with matplotlib

import pandas as pd

data = pd.Dataframe(
  # Data
)

data.plot()

Tags:

Misc Example