Answers for "bar plot"

4

how to plot a bar using matplotlib

import matplotlib.pyplot as plt  
  
   
# creating the dataset 
data = {'C':20, 'C++':15, 'Java':30,  
        'Python':35} 
courses = list(data.keys()) 
values = list(data.values()) 
   

fig = plt.figure(figsize = (5, 5)) 
  
# creating the bar plot 
plt.bar(courses, values, color ='green',  
        width = 0.4) 
  
plt.xlabel("Courses offered") 
plt.ylabel("No. of students enrolled") 
plt.title("Students enrolled in different courses") 
plt.show()
Posted by: Guest on December-01-2020
0

how to plotting bar on matplotlib

import matplotlib.pyplot as plt 

data = [5., 25., 50., 20.]
plt.bar(range(len(data)),data)
plt.show()

// to set the thickness of a bar, we can set 'width'
// plt.bar(range(len(data)), data, width = 1.)
Posted by: Guest on June-13-2020
1

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()
Posted by: Guest on October-27-2020
0

bar plot

sns.barplot(x='sex',y='total_bill',data=t)Copy
Posted by: Guest on June-26-2021
0

bar plot

df.groupby('species').mean().plot.bar()
Posted by: Guest on June-03-2021
0

bar plot

sns.boxplot(x="day",y="total_bill",hue="smoker",data=t, palette="coolwarm")Copy
Posted by: Guest on June-26-2021

Browse Popular Code Answers by Language