xxxxxxxxxx
import matplotlib.pyplot as plt
# Sample data
x = ['A', 'B', 'C', 'D', 'E']
y = [10, 5, 12, 8, 9]
# Create bar plot
plt.bar(x, y)
# Customize labels and title
plt.xlabel('Categories')
plt.ylabel('Values')
plt.title('Bar Plot Example')
# Display the plot
plt.show()
xxxxxxxxxx
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()
xxxxxxxxxx
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.)
xxxxxxxxxx
import numpy as np
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 = (10, 5))
# creating the bar plot
# the format of the bar() method is:
# plt.bar(x_value, y_value, color, width_of_bars_inches)
plt.bar(courses, values, color ='maroon',
width = 0.4)
# x-axis label
plt.xlabel("Courses offered")
# y-axis label
plt.ylabel("No. of students enrolled")
# Title of the figure
plt.title("Students enrolled in different courses")
plt.show()
xxxxxxxxxx
import numpy as np
import matplotlib.pyplot as plt
data = [[30, 25, 50, 20],
[40, 23, 51, 17],
[35, 22, 45, 19]]
X = np.arange(4)
fig = plt.figure()
ax = fig.add_axes([0,0,1,1])
ax.bar(X + 0.00, data[0], color = 'b', width = 0.25)
ax.bar(X + 0.25, data[1], color = 'g', width = 0.25)
ax.bar(X + 0.50, data[2], color = 'r', width = 0.25)
xxxxxxxxxx
import matplotlib.pyplot as plt
fig, ax = plt.subplots
# Create Bar plot
ax.bar(df.index, df["col1"], label="col1")
# Create stacked bar plot keeping the previous barplot below
ax.bar(df.index, df["col2"], bottom=df["col1"], label="col2")
# Create stacked bar plot keeping the previous barplot below
ax.bar(df.index, df["col3"], bottom=df["col1"] + df["col2"], label="col3")
# Rotate tick x axis labels to 90 degree
ax.set_xticklabels(df.index, rotation=90)
ax.set_ylabel("Y axis label")
# Show legend
ax.legend()
plt.show()
xxxxxxxxxx
import matplotlib.pyplot as plt
import numpy as np
plt.bar(np.arange(0,100),np.arange(0,100))
xxxxxxxxxx
Syntax: plt.bar(x, height, color)
x is x axis value
height is y axis value
color is optional
xxxxxxxxxx
1. Delete your .gradle folder in the user home directory
2. flutter clean
3. flutter pub get
4. launch/compile your project
xxxxxxxxxx
forfiles /P D:\ /M *.* /S /D +"01/17/2012" /C "cmd /c if @fsize gtr 209715200 echo @path @fsize @fdate @ftime"