Create a plot of the
ax DataFrame with the Matplotlib method
.plot(). Include the following arguments inside of
.plot() . You can change these on your own and run the plot again if you would like.
kind = 'barh'
title ='Representation In Movies'
ax.plot(kind='barh',title='Representation In Movies',figsize=(15,10),xlabel='Movies Inline',legend=True)
I have been trying to modify the legend from ‘total_score’ to ‘Total Score’ and change its position to ‘bottom right’ but no luck. I have tried doing it inline and also in a new variable but it doesn’t work.
Any advice would be welcome.
Full code here
You can use
plt.legend(loc = 'upper right') or wherever you want to put the legend–upper left, lower right, etc.
Or, you can use
bbox_to_anchor(x, y, width, height)
Thanks, I realized my mistake. I was writing ‘bottom right’ instead of ‘lower right’ in the loc which is why it was faulting.
Also while changing the display legend from ‘total_score’ to ‘Total Score’ I was facing an issue where it was only displaying the first letter ‘T’ of my desired text. Realized it was a bug.
The correct way to get it done is this.
plt.legend(('Total Score',),loc='lower center')
This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.