Data Visualization Using Statistical Charts by Plotly | by Himanshu Sharma | Towards Data Science

Data Visualization plays an important role in data analysis because as soon as the human eyes see some charts or graphs they try finding the patterns in that graph.
Data Visualization is visually representing the data using different plots/graphs/charts to find out the pattern, outliers, and relation between different attributes of a dataset. It is a graphical representation of data.
Statistical data analysis is a procedure for performing various statistical operations. It is a kind of quantitative research, which is performed on the data to find out the statistical properties of the data.
Python provides different libraries/packages for visualization like Matplotlib, Seaborn, ggplot, etc. But my personal favorite is Plotly because not only helps us visualize the data it creates highly interactive and visually appealing charts/bars/graphs etc.
A box plot helps us visualize the data and its quartile, one of the major benefits of a box plot is we can clearly identify the outliers. Let us plot a box plot, the data set used here is a Car Design Dataset which contains different attributes of car manufacturing companies.
import pandas as pdimport plotly.express as pxdf = pd.read_csv('car_design.csv')fig = px.box(df, x="body-style", y="price")fig.show()
Histograms are used to identify the approximate distribution of the data. In histograms, different bins are created and count for each bin is represented. Histograms are based on area, not the height of bars. In a histogram, it is the area of the bar that indicates the frequency of occurrences for each bin.
fig = px.histogram(df, x="city-mpg")fig.show()
Heatmap is a 2-D graphical representation of the data where represents the correlation between different data attributes and differentiates it on the basis of color.
fig = px.density_heatmap(df.corr())fig.show()
A Scatter plot is a type of visualization in which dots are used for displaying different values of two variables in a dataset. It is used to find the relationship between two variables.
fig = px.scatter(df, x="city-mpg", y="highway-mpg", trendline="ols")fig.show()
A violin plot is a statistical representation of numerical data. It is similar to a box plot, with the addition of a rotated kernel density plot on each side.
fig = px.violin(df, y="price")fig.show()
A 2D density plot or 2D histogram is an extension of the well-known histogram. It shows the distribution of values in a data set across the range of two quantitative variables. It is really useful to avoid overplotting in a scatterplot.
fig = px.density_contour(df, x="city-mpg", y="highway-mpg", marginal_x="histogram", marginal_y="histogram")fig.show()
In this article, we saw different statistical plots and how to plot them using Plotly, a python library used to visualization.
These plots will give you a basic idea behind statistical data visualization, you can change parameters accordingly and visualize data according to your requirement.
analyticsindiamag.com
towardsdatascience.com
towardsdatascience.com
Thanks for reading! If you want to get in touch with me, feel free to reach me on hmix13@gmail.com or my LinkedIn Profile. You can also view the code and data I have used here in my Github.