Why do i need the brackets?

Screen Link:

My Code:

fig, ax=plt.subplots()
ax.boxplot(norm_reviews['RT_user_norm'])
ax.set_ylim(0,5)
ax.set_xticklabels("Rotten Tomatoes")
plt.show()

What actually happened:
The x title is only “R”

May I know why there is a need to have brackets: [‘Rotten Tomatoes’]? So that the full name “Rotten Tomatoes” can appear?

fig, ax = plt.subplots()
ax.boxplot(norm_reviews['RT_user_norm'])
ax.set_xticklabels(['Rotten Tomatoes'])
ax.set_ylim(0, 5)
plt.show()

Hi @lauratangwt,

According to the documentation, labels here should be a list of strings (even if this list consists of only one item, in case of only one box plot on the graph, like in your case). If instead a list of strings you’ll try to assign labels as just a string, then each box plot will be labelled as each letter of that string in order. To see it, try to run this code:

num_cols = ['RT_user_norm', 'Metacritic_user_nom', 'IMDB_norm', 'Fandango_Ratingvalue']
fig, ax = plt.subplots()
ax.boxplot(norm_reviews[num_cols].values)
ax.set_xticklabels('abcd', rotation = 90)
ax.set_ylim(0, 5)
plt.show()

So, to avoid confusion, just use a list of strings, as according to the documentation.