29 Plotting Techniques. When To Use Which Plot?

Sadaf Saleem
9 min readApr 3, 2023

--

  1. 0.0. Introduction

Data visualization is the representation of data and information through graphs, charts, and other graphical elements, to help make sense of the data and find insights. It is a way to present data in a clear and meaningful manner, allowing for quick and easy interpretation.

1.2.1. Different types of Data Visualization

Pandas, a powerful data analysis library in Python, provides several types of plotting for data visualization. Here we would divide the charts into categories:

1.2.2. Capture trends over time

A line graph or a time series plot is commonly used to capture trends over time. The x-axis represents the time period, while the y-axis represents the measured variable. Points are plotted and connected by a line to show the change in the variable over time. A bar graph or column chart can also be used to show trends over time, especially when comparing multiple variables or categories. In this case, each bar represents a single time period and the height of the bar indicates the value of the variable for that time period.

Let’s study the details of each graphing tools that we can use to plot trends over time.

  1. Line chart
  2. Seasonal charts
  3. Time-series plots
  4. Autocorrelation plots
  5. Box-and-whisker plots
  6. Area Chart
  7. Stacked Area Chart
  8. Splined Chart
  9. Moving Average plots

1. Line Plot:

A line plot, also known as a line graph or a time series plot, is a type of chart used to display the trend of a continuous variable over time. The x-axis represents the time period, while the y-axis represents the value of the continuous variable. Points are plotted on the chart and connected by a line, which helps to visualize the change in the value of the variable over time. Line plots are commonly used in fields such as economics, finance, and engineering to track and analyze trends and patterns in data.

source: data-to-viz.com

2. Seasonal Charts:

Seasonal charts are a type of time series plot that are used to visualize the pattern of a variable that occurs at regular intervals, such as daily, weekly, or annually. The pattern of the variable is usually referred to as the “seasonality.” Seasonal charts are useful for identifying patterns and trends in data that are related to the time of year, such as sales, weather, or consumer behavior.

A seasonal chart is similar to a line plot, with the x-axis representing time and the y-axis representing the value of the variable. The difference is that the x-axis is divided into segments that represent the different seasons, and the line plot is repeated for each season to show the pattern of the variable for that season. This makes it easy to identify patterns that are specific to each season, and to compare the patterns across seasons.

source: stockcharts.com

3. Time-series Plots

A time-series plot is a type of chart used to display the trend of a continuous variable over time. The x-axis represents the time period, while the y-axis represents the value of the continuous variable. Points are plotted on the chart and connected by a line, which helps to visualize the change in the value of the variable over time. Time-series plots are commonly used in fields such as economics, finance, and engineering to track and analyze trends and patterns in data.

In a time-series plot, the time period can be represented as a continuous line, or as a sequence of discrete time steps. The plotted points can be connected with a line, a step function, or scattered without any line connecting them. Additionally, the time-series plot can be annotated with labels, markers, and shaded regions to highlight specific events or patterns in the data.

source: sigmamusic.com

Time-series plots are often used to perform time series analysis, which involves statistical techniques for modeling and predicting the future values of a variable based on its past values. Time-series analysis can be used for applications such as forecasting sales, stock prices, and energy demand.

4. Autocorrelation Plots

Autocorrelation plots are graphical representations of the correlation between the values of a time series and its lagged (shifted) values. Autocorrelation plots are used to evaluate the presence of serial dependence (also known as autocorrelation) in a time series, which occurs when the value of the series at time t is related to the value of the series at a previous time t-k.

Autocorrelation plots display the correlation between the time series and its lagged values, for different lag values k, on the y-axis. The x-axis represents the different lag values, and the plotted points indicate the correlation coefficient for each lag. A value close to 1 on the y-axis indicates a strong positive correlation between the time series and its lagged values, while a value close to -1 indicates a strong negative correlation. A value close to zero indicates weak or no correlation.

source: otexts.com

Autocorrelation plots are used in time series analysis to help identify patterns in the data and to select appropriate models for forecasting future values of the time series. Autocorrelation plots can also be used to determine the order of differencing required to make the time series stationary, which is a necessary step in some time series models.

5. Box-and-whisker plots

A box-and-whisker plot, also known as a box plot, is a type of chart used to display the distribution of a set of numerical data. It is particularly useful for comparing the distribution of multiple datasets or for identifying outliers in the data.

Box-and-whisker plots are widely used in data analysis and statistics for their simplicity and ability to provide a clear visual representation of the distribution of a dataset. They are particularly useful for comparing the distribution of multiple datasets, as well as for identifying skewness, symmetry, and outliers in the data.

source: datavizcatalogue.com

A box plot consists of a box and two “whiskers” drawn from the box, which represent the range of the middle 50% of the data (the interquartile range or IQR). The box is drawn between the lower quartile (25th percentile) and upper quartile (75th percentile), which mark the boundaries of the middle 50% of the data. The median of the data is indicated by a line inside the box.

Outliers in the data are plotted as individual points outside the whiskers. The presence of outliers can indicate that the data is skewed or that there are exceptional values that may warrant further investigation.

6. Area Chart

An area chart is a type of chart that is used to represent the evolution of a quantitative variable over time. It is similar to a line chart, but with the area between the line and the x-axis filled with color or shading. The x-axis represents the time period, while the y-axis represents the value of the quantitative variable.

In an area chart, the evolution of the variable over time is displayed by plotting points and connecting them with a line, and then filling the area between the line and the x-axis with color or shading. The filled area helps to emphasize the magnitude of the change in the variable over time, and makes it easier to visualize trends and patterns in the data.

source: statisticshowto.com

Area charts are often used in fields such as finance, economics, and marketing to track and analyze trends and patterns in data. They are particularly useful for visualizing the evolution of cumulative variables, such as cumulative sales or cumulative stock prices, as well as for comparing the evolution of multiple variables over time.

7. Stacked Area chart

A stacked area chart is a type of area chart that is used to display the evolution of multiple quantitative variables over time. It is similar to a traditional area chart, but each variable is displayed as a separate layer, with the layers stacked on top of each other.

The x-axis represents the time period, while the y-axis represents the sum of the values of the variables for each time period. The area for each variable is displayed as a separate layer, with the layers stacked on top of each other to form a composite picture of the evolution of the variables over time.

source: ppcexpo.com

In a stacked area chart, the evolution of each variable is displayed by plotting points and connecting them with a line, and then filling the area between the line and the x-axis with color or shading. The filled areas help to emphasize the magnitude of the change in each variable over time, and make it easier to visualize trends and patterns in the data.

Stacked area charts are often used in fields such as finance, economics, and marketing to track and analyze trends and patterns in data. They are particularly useful for comparing the evolution of multiple variables over time and for visualizing the relative contribution of each variable to the total value.

8. Splined Chart

A spline chart is a type of chart that is used to display the relationship between two variables. Unlike a traditional line chart, a spline chart uses curved lines, rather than straight lines, to connect the data points. The curved lines in a spline chart are smoothed and provide a more visually appealing representation of the relationship between the variables.

A spline chart typically consists of a single line connecting the data points, which can be represented as a scatter plot. The x-axis represents one variable, while the y-axis represents the other. The line in the chart is created by fitting a smooth curve to the data points, rather than simply connecting them with straight lines.

source: fusioncharts.com

Spline charts are often used in fields such as engineering, finance, and statistics to visualize the relationship between two variables. They are particularly useful for analyzing and interpreting data with a high degree of variability, as the curved lines can help to identify trends and patterns in the data that might not be immediately apparent in a traditional line chart.

9. Moving Average Plots

A moving average plot is a type of chart used to analyze time series data. It is used to smooth out fluctuations in the data and identify trends and patterns in the underlying data over time.

A moving average is calculated by taking the average of a set of consecutive data points, and then plotting this average as a new data point. The moving average is calculated for a set of data points that “slide” over the data set, so that the moving average for each time point is based on a fixed number of surrounding data points.

source: georgiaruralhealth.com

The number of data points used to calculate the moving average is called the “window size”. A smaller window size will result in a more sensitive moving average, highlighting smaller fluctuations in the data, while a larger window size will result in a smoother moving average, highlighting trends and patterns in the data.

Moving average plots are often used in fields such as finance, economics, and engineering to analyze trends and patterns in time series data. They are particularly useful for smoothing out fluctuations in the data and for identifying underlying trends and patterns in the data that might not be immediately apparent in the raw data.

In the upcoming articles, we would also be covering more plotting technique that includes;

1.2.3. Capture Distributions

  1. Histograms
  2. Box plot
  3. Violin plot
  4. Density plots
  5. Kernel Density plots
  6. Swarm plots
  7. Empirical cumulative distribution function (ECDF) plots

1.2.4. Visualizing Relationships

  1. Bar chart
  2. Scatter plot
  3. Multi-line chart
  4. Bubble chart
  5. Column chart
  6. Correlation matrix plot
  7. Simple linear regression plots
  8. Connected scatterplot
  9. LOWEES (Locally Weighted Scatterplot Smoothing) plots

1.2.5. Whole-Charts

  1. Pie chart
  2. Heatmaps
  3. Donut pie chart
  4. Stacked Column chart

--

--

Sadaf Saleem

I believe learning is all about sharing and uplifting each other. Let's connect!