
Image by Editor (Kanwal Mehreen)| Canva
Introduction
Data visualization is an indispensable part of data analysis as a whole, from analytics to business intelligence (BI) and monitoring the performance of a system or model. Visualizations are paramount in uncovering insights, communicating them clearly, and guiding both strategic and operational decision-making. Yet, often we may not be sure, given the available data to visualize and the purpose of the visualization, which type of graph to use.
This guide provides a simple yet pretty exhaustive decision tree to help you choose the most appropriate graph based on your data type and visualization goal. While there are many more types of graphs out in the wilderness, you’ll notice that 99% of the time, one of the graph types described in this guide will be valid for your data and the problem at hand.
Choosing the Best Visualization Graph
The diagram below depicts a visual guide to help you choose the right graph for your data and task at hand.

Choosing the right graph for your data (click to enlarge)
As you can see, the starting point is the node right in the middle of the tree; therefore, a key question to ask is: What is the goal of your intended visualization? Answering this question clears much of the decision-making burden, hinting at a much narrower — or even singleton — set of options.
If you want to compare categories or groups under a categorical variable, chances are you want your visualization to emphasize either the counts (frequencies) per category or their relative proportions as parts of a whole. In the former case, bar charts and bar histograms are the way to go. Bar charts are the “default option” to view frequencies of categories in purely categorical variables, but sometimes you may take a numerical variable like “age” as a starting point and discretize it into bins like “age group”: in that case, consider also using a bar histogram. Meanwhile, to emphasize proportions, a pie chart will do the trick, but bear in mind that pie charts are best used when the number of categories (or bins) is low, ideally no larger than five.

Interested in displaying the distribution followed by a numeric variable? If the variable is continuous, for instance, showing the distribution of people by age, again, you may want to use a histogram. It could be a bar histogram or line histogram, depending on the granularity of the variable and whether you would like a smoother look that resembles density-like shapes. Sometimes bar histograms can be combined with a smoother curve, called KDE (Kernel Density Estimate): specialized tools and programming language libraries allow you to do this. On the other hand, if you want a more heavily statistical look at how your variable distributes in terms of median, quartiles, and possible outliers, the boxplot would be the most appropriate approach.
To visualize trends over time (and perhaps sometimes over space, think, for instance, about plotting the altitude in metres for every kilometer point across a highway), the line plot is your solution. This is the “default” go-to approach to visualize time series data, and it can be overlaid to visualize temporal breakdown for multiple categories or attributes: for example, a simple line plot can be used to visualize daily passenger number for public transportation in a city, whereas one that overlays multiple lines can separate daily passenger number for bus from those for train.
To explore the relationship or correlation between two numeric variables, e.g., the years of experience vs. salary, you may want to use a scatterplot, which can sometimes even help identify clusters of similar data points or outliers. Points can be colored or sized to incorporate additional information from extra categorical or numeric attributes.
Another approach to analyze pairwise relationships or analyze patterns is heatmaps. Unlike scatterplots, heatmaps can be used when the data is structured in a logically grid-like or tabular format, for instance, to record the average temperature in Osaka per month and year, such that months are depicted along one axis and years along the other. In essence, when the data being plotted can be displayed like a matrix, a heatmap helps uncover underlying trends, highlight anomalies, and visually compare values across categories based on color intensity or gradients in a color palette.
Last, when the data includes geographical features, typically latitude or longitude, but also country codes or province IDs, use a geographic map based on color-codes for regions or markers to show intensity or value of variables like temperature, rainfall, population density, rate of unemployment, and so on.

Wrapping Up
This article presented a guide to help you decide on the best visualization graph for your data, primarily based on the intended task and properties to visualize. From bar charts to scatterplots to maps, the article outlines types of plots that can accommodate numerical and categorical data, analyze frequencies, distributions, temporal trends, relationships, and more.

Thanks, it´s very usefull for me.
You are very welcome Fernando!