Each of the charts has its own application and the chart should be studied prior to applying it to a problem. So, the numerous options associated with charts is what makes them special. R, as a statistical tool, offers strong visualization capabilities. + main = "Displacement for Car Models", xlab = "Displacement in cubic inches")Īnalytics in a true sense is leveraged only through visualizations. So, now we will sort the dataset on displacement values, and then plot them by different gears using dotchart() function.ĭotchart(m$disp, labels = row.names(m), groups = m$gear, color = m$color, cex = 0.75, pch = 20, + main = "Displacement for various Car Models", xlab = "Displacement in Cubic Inches") The dotchart() function plots displacement for various car models as below.ĭotchart(disp, labels = row.names(mtcars), cex = 0.75, For the below illustration, mtcars dataset has been used. This visualization tool is useful if we want to compare multiple categories against a certain measure. + main = "Comparison amongst Girth, Height, and Volume of trees") ![]() In the legend “lty = 1:1” parameter means that we have the same line type for all variables, and “cex” represents the size of the points. Having legend is important here, as it helps understand which line represents which variable. The “ylim” parameter in plot() function has been, to accommodate all three line charts properly. Then line charts for Height and Volume are plotted on the same plot using lines() function. So, as shown in the below code, initially, and the line chart for Girth is plotted using plot() function. In the following illustration, we will try to understand the trend of three tree features. ![]() They help us relationship between multiple variables in a single plot. Line charts are useful when comparing multiple variables. Scatterplot3d(Girth, Height, Volume, main = "3D Scatterplot of trees dataset") So, the following code generates a 3d graph as shown below the code. So, to make scatterplots available in 3d, firstly scatterplot3d package must be installed. They make visualization possible in three dimensions which can help to understand the relationship between multiple variables. Pairs(trees, main = "Scatterplot matrix for trees dataset") Implementing the visualization is quite simple, and can be achieved using pairs() function as shown below. R allows us to compare multiple variables at a time because of it uses scatterplot matrices. Plot(Girth, Volume, main = "Scatterplot of Girth vs Volume", xlab = "Tree Girth", ylab = "Tree Volume")Ībline(lm(Volume ~ Girth), col = "blue", lwd = 2) The chart created by the following code shows that there exists a good correlation between tree girth and tree volume. ![]() Plot(Girth, Height, main = "Scatterplot of Girth vs Height", xlab = "Tree Girth", ylab = "Tree Height")Ībline(lm(Height ~ Girth), col = "blue", lwd = 2) We have added a trend line to it, to understand the trend, the data represents. The following code generates a simple Scatterplot chart. The chart gives the idea about a correlation amongst variables and is a handy tool in an exploratory analysis. ![]() This plot is a simple chart type, but a very crucial one having tremendous significance. + main = "Histogram of Tree heights with Kernal Denisty plot", Hist(trees$Height, breaks = 10, col = "orange", The following code does this, and the output is shown following the code. This offers more insights into data distribution, skewness, kurtosis, etc. To understand the trend of frequency, we can add a density plot over the above histogram.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |