0% found this document useful (0 votes)
11 views32 pages

Python Data Visualization Cheat Sheet

This document is a cheat-sheet for data visualization in Python using three libraries: Pandas, Matplotlib, and Seaborn. It provides syntax and examples for creating various types of charts such as line graphs, bar charts, pie charts, and scatter plots. Additionally, it outlines the advantages and disadvantages of each library for data visualization.

Uploaded by

harley.92225
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views32 pages

Python Data Visualization Cheat Sheet

This document is a cheat-sheet for data visualization in Python using three libraries: Pandas, Matplotlib, and Seaborn. It provides syntax and examples for creating various types of charts such as line graphs, bar charts, pie charts, and scatter plots. Additionally, it outlines the advantages and disadvantages of each library for data visualization.

Uploaded by

harley.92225
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

P y t h o n v i s u a l i z a t i o n c h e a t s h e e t

TABLE OF CONTENTS

Pandas Visualization
Matplotlib Visualization
Seaborn Visualization

[Link]
IMPORTANCE NOTE

1. Data in this cheat-sheet: Link


2. IDE Coding: Jupyter Notebook

This cheat-sheet was created by MindX's R&D Team.


Bản quyền chương trình thuộc về R&D Team của MindX
DATA VISUALIZATION
WITH PANDAS

[Link]
DATA VISUALIZATION WITH PANDAS
Pandas is a library in Python, it help Data-er can
manipulation data easily.
Pandas has method plot() to draw charts basic
such as: line, bar, pie, hist, boxplot, ...
Syntax to import library and reading data into file csv:

Result of above code:

[Link]
DATA VISUALIZATION WITH PANDAS
LINE GRAPH
Pandas has method plot() to draw chart from dataframes.
Plot() can create any charts such as: Line, bar, pie, hist, boxplot...
Syntax: plot() or [Link]()

[Link]
DATA VISUALIZATION WITH PANDAS
LINE GRAPH
Syntax: plot() or [Link]()

With syntax [Link](), we have same the result with [Link]()

[Link]
DATA VISUALIZATION WITH PANDAS
SCATTER CHART
Syntax: plot(kind= ‘scatter', x =, y = ) or [Link](x, y )

[Link]
DATA VISUALIZATION WITH PANDAS
SCATTER CHART
With [Link](x = , y = ), we have same the result with plot
(kind = ‘scatter')

[Link]
DATA VISUALIZATION WITH PANDAS
BAR CHART
Syntax: plot(kind = ‘bar’, x = , y =) or [Link](x = , y = )

[Link]
DATA VISUALIZATION WITH PANDAS
BAR CHART
With syntax [Link](), we have same the result with plot(kind
=‘bar')

[Link]
DATA VISUALIZATION WITH PANDAS
PIE CHART
Syntax: plot(kind = ‘pie’, y = ) or [Link](y = )

[Link]
DATA VISUALIZATION WITH PANDAS
BOX PLOT
Syntax: plot(kind = ‘box’, x = , y = ) or [Link]( by = )

[Link]
Advantage - Disadvantage
DATA VISUALIZATION WITH PANDAS

Advantage Disadvantage

Support draw the commons Don't support any chart complex


chart such as: violin, ...

Complex code when draw


Can draw chart from columns
columns needed compute such as
into dataframe
count, sum, ...

High performance when draw Low performance when draw with


in small dataframe large dataframe

Draw raw chart simple Limitation Customize

[Link]
DATA VISUALIZATION
WITH MATPLOTLIB

[Link]
DATA VISUALIZATION WITH MATPLOTLIB
Matplotlib is a library in Python, it is designed for visualization
chart from data
Matplotlib support many type of charts from 2D to 3D, with
multiple features
Syntax to import library and reading data into file csv:

Result of above code:

[Link]
DATA VISUALIZATION WITH MATPLOTLIB
CONFIG CHART'S SIZE
Syntax: [Link](figsize = (number_x, number_y) ) with:
number_x : Width of chart in inches
number_y : Height of chart in inches

[Link]
DATA VISUALIZATION WITH MATPLOTLIB
LINE GRAPH
Syntax: [Link]( **kwargs )

[Link]
DATA VISUALIZATION WITH MATPLOTLIB
BAR CHART
Syntax: [Link]( x, height, width, bottom, align )

[Link]
DATA VISUALIZATION WITH MATPLOTLIB
Add label value into bar chart with matplotlib
Syntax: plt.bar_label( chart_container, padding)

[Link]
DATA VISUALIZATION WITH MATPLOTLIB
PIE CHARTS
Syntax: [Link](data, explode=None, labels=None, colors=None,
autopct=None, shadow=False)

[Link]
DATA VISUALIZATION WITH MATPLOTLIB
PIE CHARTS
Syntax: [Link](data, explode=None, labels=None, colors=None,
autopct=None, shadow=False)

[Link]
LET'S TAKE A LOOK AT SOME CHARTS
WITH MATPLOTLIB

Bar of pie chart Hat graph

[Link]
Violin plot
Advantage - Disadvantage
DATA VISUALIZATION WITH MATPLOTLIB

Advantage Disadvantage

Support draw many types of Complex to understanding how to


charts matplotlib draw

Complex code when draw


Support customize chart by
columns needed compute such as
parameters
count, sum, ...

High performance when draw Low performance when draw with


in small dataframe large dataframe

[Link]
DATA VISUALIZATION
WITH SEABORN

[Link]
DATA VISUALIZATION WITH SEABORN
Seaborn is a library, same as Matplotlib,
however, Seaborn comes after, it has many
features that make data visualization in Python
simpler than Matplotlib
Syntax to import library and reading data into file csv:

Result of above code:

[Link]
DATA VISUALIZATION WITH SEABORN
LINE GRAPH
Syntax: [Link](data, x, y, hue, **kwargs)

[Link]
DATA VISUALIZATION WITH SEABORN
COUNT PLOT
Syntax: [Link](data, x, y, hue, **kwargs)
A count plot can be thought of as a histogram across a
categorical, instead of quantitative, variable.

[Link]
DATA VISUALIZATION WITH SEABORN
PAIR PLOT
Syntax: [Link](data, hue, **kwargs)
Pair plot is used to plot pairwise relationships in a dataset.

You can see the result of script above into next page

[Link]
DATA VISUALIZATION WITH SEABORN
PAIR PLOT

[Link]
DATA VISUALIZATION WITH SEABORN
HEATMAP
Syntax: [Link](data, anot , **kwargs)
A heat map is a two-dimensional representation of data in
which various values are represented by colors

[Link]
T H E E N D !
H o p e t h i s d o c u m e n t i s u s e f u l t o y o u

You might also like