Setting plotly as a backend for pandas, you can produce plots quickly and easily using:
df.plot()
How can you make this setup produce other plots than lineplots? And what other options are there?
Setting plotly as a backend for pandas, you can produce plots quickly and easily using:
df.plot()
How can you make this setup produce other plots than lineplots? And what other options are there?
You can define which plot type you'd like to produce through the kind argument in:
df.plot(kind='line')
kind='line' produces the very same plot as in the question. Valid options are:
['scatter', 'line', 'area', 'bar',
'barh', 'hist', 'box', 'violin',
'strip', 'funnel', 'density_heatmap',
'density_contour', 'imshow']
You can easily study them all by running:
for k in kinds[:-1]:
df.plot(kind=k).show()
Notice that I've used kinds[:-1]. This is because imshow is for image data and requires a dataset a bit more complicated than [1,2,3,4,5,6]. Please refer to this and Plotting an image with imshow from a pandas dataframe
In order to set the titles and title colors for all other options, here's a complete code snippet:
import random
import pandas as pd
random.seed(123)
df = pd.DataFrame({'x':[1,2,3,4,5,6]})
pd.options.plotting.backend = "plotly"
kinds = ['scatter', 'line', 'area', 'bar', 'barh', 'hist', 'box', 'violin', 'strip', 'funnel', 'density_heatmap', 'density_contour', 'imshow']
for k in kinds[:-1]:
fig = df.plot(kind=k, title = k)
fig.update_layout(title = dict(font=dict(color='#EF553B')))
fig.show()