The Python Data Visualization Essentials

import matplotlib.pyplot as plt%matplotlib inline

Scatter Plots — plt.scatter()
  • plt.title(), which adds a title to your plot
  • plt.legend(), which will provide a key that describes what is being plotted. *Pro tip* If you use the label parameter mentioned above while also using plt.legend(), it will take what you put in the label parameter and include it in your key.
  • plt.xlabel(), which labels the x-axis
  • plt.ylabel(), which labels the y-axis
  • plt.figure(figsize=(width, height)), which will determine the size of your plot, in inches
plt.figure(figsize=(10,6))plt.scatter(x, y, label = "This will appear in legend")plt.xlabel('X Values')
plt.ylabel('Y Values')
plt.title('Scatter Plot in Matplotlib')

Bar Graphs —
plt.figure(figsize=(10,6)), y, label=’Sample Data’)plt.xlabel(‘Programming Languages’)
plt.ylabel(‘Language Frequency’)
plt.title(‘Popular Programming Languages’)

Histograms — plt.hist()
plt.hist(x, bins = 10, edgecolor=’black’)plt.xlabel(‘Groups’)
plt.ylabel(‘Frequency of Values’)
plt.title(‘A Histogram in Matplotlib’)




Fitness, Sports, Data — And not necessarily in that order

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

The Gift of Rust — Merry Christmas!

Top 9 YouTube Channels for Programmers

NoNotes: Call Recording App for iPhones

AWS Elastic load balance and CORS issues

Composing Elements in a Cutscene- Game Dev Series 62

How to implement navigation drawer in your android app with an example


The Differences and Your First Time Setup

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Acusio Bivona

Acusio Bivona

Fitness, Sports, Data — And not necessarily in that order

More from Medium

Data visualization on python: lecture 2

An Alliance: Python and R (EDA)

Bring your boring plots to life by animating them (using plotly express)

Using style.applymap() as an Seaborn Heatmap alternative