plotly bar plot code example

Example 1: bar plot matplotlib

import matplotlib.pyplot as plt
fig = plt.figure()
ax = fig.add_axes([0,0,1,1])
langs = ['C', 'C++', 'Java', 'Python', 'PHP']
students = [23,17,35,29,12]
ax.bar(langs,students)
plt.show()

Example 2: ploly bar chart

import plotly.express as px
data_canada = px.data.gapminder().query("country == 'Canada'")
fig = px.bar(data_canada, x='year', y='pop')
fig.show()

Example 3: bar plot python

import matplotlib.pyplot as plt
import numpy as np
plt.bar(np.arange(0,100),np.arange(0,100))

Tags:

Misc Example