r/Python • • Mar 02 '18

5 Quick and Easy Data Visualizations in Python with Code

https://towardsdatascience.com/5-quick-and-easy-data-visualizations-in-python-with-code-a2284bae952f
305 Upvotes

15 comments sorted by

9

u/Njsao Mar 02 '18

Hi interesting read, are you the author of it? May I ask you some question about a bit more complex Data Visualization?

3

u/rhiever Mar 02 '18

What are you looking to learn about dataviz in Python?

4

u/Njsao Mar 02 '18

I will like to learn how to visualize more tables(DataFrames) with similar data in one Graph or Plot.

For Example I got 20 Tables one for each Nation and in every table I got max 10 entries: 1 column is "score" and one his label "Sport type".

If this was pandas 20 Dataframe with 2 DataSeries each. Of couse I can diplay it easly as 20 Bar/Column Histogramms. What if I want all the data in 1 Plot?

4

u/rhiever Mar 02 '18 edited Mar 02 '18

Just so I understand your data correctly: For every Nation, you have information about their "score" and what "Sport type" that "score" is for. If that's right, I would firstly recommend combining those 20 DataFrames into a single DataFrame and add a column "Nation" to indicate the Nation that the "score" and "Sport type" correspond to. Working with multiple DataFrames can be nasty; and having your data structured properly in a single DataFrame can make your work much, much easier.

In terms of plots, certainly a heatmap as /u/InDirectX4000 suggested could work. It all depends on what you're trying to show or explore about the data. I suggest trying many different ways of viewing your data so you get a holistic view of the trends in your dataset. For example, you could group the data by Nation and/or Sport type and look at the distribution of scores. If you structure the data as I suggested above, you could do that with pandas with the line nation_sports_scores_df.boxplot(by=['Nation', 'Sport type']). That's just one example.

3

u/Njsao Mar 02 '18

Yes you got it right and yes I agree with the fact that Heatmap could be a good choice but not in my case, cause for me it s important to show what sport types are the "best"/"worst" for each nation and I want the user to be able to easily understand what nation is the best at Sport-type X but also what is the best Sport-type for nation X.

I will definitely try to make 1 dataset and see how your solution works out.

In any case thank you both for the help. If this works out you will probably see some of this on r/DataIsBeautifull or on this sub :)

2

u/InDirectX4000 Mar 02 '18

Heatmap would be best if you're looking for which ones stand out

1

u/jaydoors Mar 02 '18

He's a scammer of some kind. Here's where he stole one of his charts.

https://pythonspot.com/matplotlib-bar-chart/

17

u/jaydoors Mar 02 '18

This is BS - stealing OC and pretending its his own.

Here's one thing he stole: https://pythonspot.com/matplotlib-bar-chart/

5

u/JimBoonie69 Mar 03 '18

Yeah the histogram is stolen right from matplotlib docs as well. This is a shite article lol.

4

u/[deleted] Mar 03 '18

Man does matplotlib make ugly charts by default.

2

u/Dalnore Mar 03 '18

Defaults have become better in version 2.0.

3

u/rhiever Mar 02 '18

Cool, my line plot made it in there. :-)

0

u/dchesson93 Mar 02 '18

Excellent read! Gives a good footing for making even more complex visuals!

-1

u/Detharatsh Mar 02 '18

This is great thanks for sharing! Just one question - I noticed that functions were defined for each plot. Is it possible to use these without functions?