A story that Seaborn was easy, convenient and impressed

Seaborn

I was impressed that even a graph that is a little troublesome to draw with matplotlib can be drawn relatively easily with seaborn.

スクリーンショット 2020-03-19 20.20.03.png

If you try to draw this with matplotlib, it will look something like this. It may be wrong because it is super suitable,

import itertools
fig, axes = plt.subplots(2, 3)
col_f = 'Pclass'
col_f_domain = [1, 2, 3]
row_f = 'Sex'
row_f_domain = ['male', 'female']
for i, (r, c) in enumerate(itertools.product(row_f_domain, row_f_domain)):
    row_i = i // 3
    col_i = i % 3
    ax = axes[row_i][col_i]
    # (The following is omitted)

Oh yeah, don't turn the for loop. This is one line for seaborn ...

sns.relplot(x='Age', y='Fare', hue='Survived', col='Pclass', row='Sex', data=train_data)

Finally

When performing EDA (Exploratory Data Analysis), many graphs are drawn while changing the features and levels to be compared, so there is a tool that can quickly apply such complicated plots. It comes in handy. On the contrary, matplotlib is good at being able to handle itching that cannot be reached with such high-level tools. I think I should use matplotlib to draw plots that Seaborn cannot draw.

Recommended Posts

A story that Seaborn was easy, convenient and impressed
A story that I was addicted to at np.where
A story that was terrible if SELinux was properly disabled
A story that was convenient when I tried using the python ip address module
A story that I wondered if it stopped working at mglearn.plots.plot_nmf_faces and was an error?
A story that makes it easy to estimate the living area using Elasticsearch and Python
A story that I was addicted to calling Lambda from AWS Lambda.
A story that was struggling to loop processing 3 million ID data
Asynchronous API that combines API Gateway and Step Functions was the strongest story
A story connecting Slack and google spreadsheets
A story that stumbled upon installing matplotlib
A story that stumbled upon a comparison operation
A story about Python pop and append
The story that XGBoost was finally installed
The story of making a box that interconnects Pepper's AL Memory and MQTT
A story that I was addicted to when I made SFTP communication with python
A story that I was very convinced when I wrote the code for the Monty Hall problem and calculated the winning percentage
A nice nimporter that connects nim and python
A story about Go's global variables and scope
python memo-"if not A and B" was "if (not A) and B"
A story about modifying Python and adding functions
A story that an error occurred when PyInstaller was used in a program that uses googleapiclient