Hey guys,
I am currently finishing the Step 2 of the course doing the Star Wars Survey. I decided to create a for loop in order to automatize the creation of charts. My code looks like this:
## Rankings
categories = [males, females,star_trek_fan, star_trek_not_fan, sw_fan, sw_not_fan]
categories_names = ['males', 'females','star_trek_fan', 'star_trek_not_fan', 'sw_fan', 'sw_not_fan']
fig, axes = plt.subplots(nrows = 3, ncols= 2, figsize=(15,15))
fig.subplots_adjust(hspace=0.2, wspace = 0.2)
fig.suptitle('Ranking of Means', size = 20)
for category, sp, category_name in zip(categories, range(0,6), categories_names):
rankings = [col for col in category if col.startswith('ranking')]
ranking_means = category[rankings].mean()
y_pos = np.arange(len(rankings))
ax = fig.add_subplot(3, 2, sp+1)
ax.bar(rankings, ranking_means, align='center', alpha=0.5)
ax.tick_params(bottom="off", top="off", left="off", right="off")
ax.set_title(category_name)
## Watched movies
categories = [males, females,star_trek_fan, star_trek_not_fan, sw_fan, sw_not_fan]
categories_names = ['males', 'females','star_trek_fan', 'star_trek_not_fan', 'sw_fan', 'sw_not_fan']
fig, axes = plt.subplots(nrows = 3, ncols= 2, figsize=(15,15))
fig.subplots_adjust(hspace=0.2, wspace = 0.2)
fig.suptitle('Most Watched Movies', size = 20)
for category, sp, category_name in zip(categories, range(0,6), categories_names):
seen = [col for col in category if col.startswith('seen')]
seen_movies = category[seen].sum()
y_pos = np.arange(len(seen))
ax = fig.add_subplot(3, 2, sp+1)
ax.bar(seen, seen_movies, align='center', alpha=0.5)
ax.tick_params(bottom="off", top="off", left="off", right="off" )
ax.set_title(category_name)
The thing is that with the graphs created, I can’t hide the numbers in the axis. Let me show you through a picture:
As you can see, the axis have both the numbers and the labels and I don’t know how to hide them.
Could you help me with this?
Thank you!