hi hello
its my second time using matplotlib
this time trying to make bars plt.bar()
i found this tutorial
code:
def favorite_tanks():
tanks = [
i
for entry in contents
for i in entry.liketank
]
sorted_tanks = sorted(tanks, key=lambda s: tanks.count(s))
sorted_counts = sorted(list(collections.Counter(tanks).values()))
counts_x = range(len(sorted_counts))
plt.bar(counts_x, sorted_counts)
plt.xticks(counts_x, sorted_tanks)
plt.title("Favorite tanks")
full code: https://paste.pythondiscord.com/BHDQ
i am trying to create a bar, where each name has the height of the amount of times it was chosen in my google form
tanks is a flattened list, each containing a name, i want to count the occurence of each of the names, and then sort based off the results
In this matplotlib tutorial, I will walk you through how to plot a bar graph with matplotlib package in Python.
A bar graph is a visualization tool to present categorical data, and is also one of the most used chart types beside a line graph. This tutorial is catering toward beginners, so I will only cover just the basics in this lesson.
๐ Mat...