How to make AMAZING graphs in Python that everyone will understand

2 min

The main job of a Data scientist is to transform chaotic data into actionable decisions.

In other words, try to explain complex data in a way that everyone understands.

Your reader will have no time and no energy to try to understand what's going on in your graph.

This is why you will have to do your best to make your graphs self-explanatory.

Clear and effective data visualization is important because it helps to quickly and easily understand complex data patterns, trends, and relationships. A well-designed graph can help to make informed decisions, communicate insights to others, and tell a compelling story with data.

Here are 5 rules which are essential if you want to make outstanding and self-explaining graphs:

  1. Keep it simple
  2. Don't over-engineer it
  3. If it's easier to read, it's better.
  4. Write labels and legends according to your reader.
  5. Would Grandma understand?

There are several libraries in Python that are commonly used for data visualization, including:

  1. Matplotlib: A low-level plotting library that provides a variety of graph types and customization options.
  2. Seaborn: A high-level visualization library built on top of Matplotlib that provides a simple interface for creating elegant and informative statistical graphics.
  3. Plotly: An open-source library for creating interactive and animated plots, with a variety of chart types and customization options.
  4. Bokeh: A library for creating interactive and web-based plots, with support for large datasets and real-time updates.
  5. ggplot: A library based on the ggplot2 package in R, designed to provide a high-level interface for creating elegant and complex data visualizations.

These libraries offer different levels of abstraction, customization options, and interactivity, so it's important to choose the right one for your specific use case and data analysis needs. Regardless of which library you choose, clear and effective data visualization is a valuable tool for data analysis and communication.

Here is an example of graph with Seaborn

Seaborn is a data visualization library in Python that is built on top of Matplotlib and provides a high-level interface for creating beautiful and informative statistical graphics. Here's a simple example of how to make a graph using Seaborn:

import seaborn as sns
import matplotlib.pyplot as plt

# load example data
tips = sns.load_dataset("tips")

# create a scatterplot
sns.scatterplot(x="total_bill", y="tip", data=tips)

# display the plot
plt.show()

This will create a scatterplot of total bill amount vs. tip amount, based on the tips dataset. You can easily change the type of graph by specifying a different Seaborn function such as lineplot, histplot, boxplot, etc. You can also customize the appearance of the graph by adding labels, titles, changing colors, and more.