Getting started with Visualizations in Python

First things first, don’t even think of relating it with Bar graphs.

-Histograms are very different from Bar graphs, in the sense that a bar graph relates two variables, but a histogram relates only one.

Let’s take a look into the Titanic Dataset for this one;Histogram help us come up with inferences something like what if I was a girl with some age, what could be the probability I’d survive.

No, I don’t want to be a Girl, I just don’t want to die like Jack.

Assuming you got this, let’s rush to the code.

Plotly provides different classes that when fed the data, can deliver amazing results, plotly.

figure_factory is one of them,fig = ff.

create_distplot(hist_data, #Used for finding distribution group_labels, #Labels of the classes used bin_size=1.

5, #Width of the bin colors = ['#393E46', '#2BCDC1'], show_rug=False)Looks Easy, Outputs Fancy!Looking at this we can easily provide the answer to the previous question, It’s likely I could have survived If I was a girl of somewhat aged 18 to 35, for the fact we can see here the density of survival of a female is highest in between 18 to 35.

One of the proofs why Rose survived, and if we plot for male, we’ll surely get to know why Jack didn’t.

Isn’t that easy!Now you guys are like,Ok, I’ll give you that.

Box Plots:It is a method for graphically depicting groups of numerical data through their quartiles.

This guy captures a lot of information, I mean A LOT.

It gives you a good indication of the spread, how the values are spread out in the data.

They are a standardized way of displaying the distribution of data based on a five number summary (“minimum”, first quartile (Q1), median, third quartile (Q3), and “maximum”), that’s quite a lot information in a plot.

Talk is Cheap!.Don’t remind me, I know.

We’ll consider the same titanic data for this, but rather than age we’ll do it on the fares.

Similarly to line plots, we have plotly.



Box with which we can pass the values and it will convert it to Box plot obj.

trace0 = go.

Box( x = train.

loc[(train['Sex']=='female'), 'Fare'].


values, name = "Female")Though you guys are smart, Box plots are even smarter.

Looking at this we can give an inference that most of the Male passengers were traveling cheap whereas most of the women had expensive tickets and were mostly high class.

Now Titanic make sense to me, the reason why Jack got hooked up with Rose, and also why he did not survive.

Data speaks.


. More details

Leave a Reply