How to Do Scatter Plots in Python

This tutorial shows how to use Pandas, Matplotlib, and Seaborn for scatter plots in Python with examples, codes, and charts. There are two methods of doing scatter plots in Python. The following shows the core syntax. Pandas: df.plot (kind=”scatter”, x=”column_x”, y=”column_y”) Seaborn: sns.lmplot (x=”column_x”, y=”column_y”, data=df, fit_reg=True) Example 1: Use Pandas for scatter plots in … Read more

Plot Histogram in Python

Introduction We can use hist() in Matplotlib, pandas, and seaborn to plot histograms in Python. The following is the basic syntax of plotting histogram using these 3 different modules. Method 1: Using matplotlib plt.hist(data,bins=’auto’) Method 2: Using pandas pd.hist() Method 3: Using seaborn sns.histplot(data=dataset, x=’column_name’) Sample Data for Histogram We generate a randon sample of … Read more

How to Plot Bar Charts in Python

This tutorial will show how you can plot bar charts using Python with detailed examples. Similar to line charts, bar charts show the relationship between X (on x-asix) and Y (on Y-asix). I will first use the same data as in line charts to illustrate how to plot bar charts. Then, I will use another … Read more

How to Plot Line Charts in Python

Line charts are typically used to show the overall trend of a certain topic. For instance, you can use a line chart to show the overall price movement of a stock or people’s interest in a certain topic or object. The following shows the core syntax to plot line charts in Python, including Seaborn, matplotlib, … Read more

Tutorial of Data Visualization Using Python

Introduction This tutorial shows how to plot line charts, bar charts, and scatter plots in Python. The major packages being used include Pandas, Matplotlib, and Seaborn. Note that, Pandas plot functions and Seaborn build on the top of Matplotlib, and thus you can use some functions from Matplotlib. In some situations, I found it easier … Read more