I am doing my final portfolio project for Machine Learning and AI Fundamentals, and I am trying to use a pie chart to compare the amount of money the publishers in each genre of my dataset have made globally. However, my pie chart looks like this:
Not sure if uploading a screenshot works, but basically, there are way too many values, the table of contents is blocking the actual chart, and some of the percentages don’t fit on their tiny slices.
Does anyone know a better way i can present this data, in a way that is easy to show the big differences between the publishers?
Thank you so much,
How about a bar chart?
You can make the dimensions of the bar chart larger (
figsize =) angle the names (rotate axis) of the companies so that they’re readable. (
plt.xticks(rotation=45) #or whatever number of degrees)
I tried to do this, but I got an error:
I think this is because my sports_global_sales is all floats, but I can’t think of any way to fix this besides rounding, but then I feel I would lose a lot of data.
Is there any other solution, or maybe a different way to visualize this data?
So you have a categorical variable and a quantitative variable. Can’t you change the float to an int using
df['col'] = df['col'].astype(int)
Oh, I didn’t know I could do that! Thanks!
Turns out it wasn’t even the sports_global_sales that was the problem, it was sports_publishers.
But I was able to turn them all the publisher names into strings using your suggestion.
Guess I should look closer at the columns I’m using. Thanks again!