Top menu

R Data Visualization Training Chennai

R Data Visualization Training Chennai

R Data Visualization training chennaiR Programming offers a satisfactory set of inbuilt function and libraries (such as ggplot2, leaflet, lattice) to build visualizations and present data. In this article, I have covered the steps to create the common as well as advanced visualizations in R Programming. But, before we come to them, let us quickly look at brief history of data visualization.

Let Your data tell the story at R VisualizationTraining Chennai

Email : info@bigdatatraining.in
Call – +91 97899 68765 / +91 9962774619 / 044 – 42645495

Brief History of Data Visualization:

Historically, data visualization has evolved through the work of noted practitioners. The founder of graphical methods in statistics is William Playfair. William Playfair invented four types of graphs:   the line graph, the bar chart of economic data , the pie chart and the circle graph. Joseph Priestly had created the innovation of the first timeline charts, in which individual bars were used to visualize the life span of a person (1765). That’s right timelines were invented 250 years and not by Facebook!

Among the most famous early data visualizations is Napoleon’s March as depicted by Charles Minard. The data visualization packs in extensive information on the effect of temperature on Napoleon’s invasion of Russia along with time scales. The graphic is notable for its representation in two dimensions of six types of data: the number of Napoleon’s troops; distance; temperature; the latitude and longitude; direction of travel; and location relative to specific dates

Florence Nightangle was also a pioneer in data visulaization. She drew coxcomb charts for depicting effect of disease on troop mortality (1858). The use of maps in graphs or spatial analytics was pioneered by John Snow ( not from the Game of Thrones!). It was map of deaths from a cholera outbreak in London, 1854, in relation to the locations of public water pumps and it helped pinpoint the outbreak to a single pump.

Power of R Data Visualization

R Data Visualization Training Chennai

 

R Data Visualization training in chennai

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

R Data Visualization training Chennai

 

 

 

 

 

 

 

 

 
One of the hardest parts of an analysis is producing quality supporting graphics. Conversely, a good graph is one of the best ways to present findings. Fortunately, R provides excellent graphing capabilities, both in the base installation and with add-on packages such as lattice and ggplot2. We will briefly present some simple graphs using base graphics and then show their counterparts in ggplot2. This will be supplemented throughout the book where supporting graphics—with code—will be made using ggplot2 and occasionally base graphics.
Graphics are used in statistics primarily for two reasons: exploratory data analysis (EDA) and presenting results. Both are incredibly important but must be targeted to different audiences.
When graphing for the first time with R, most people use base graphics and then move on to ggplot2 when their needs become more complex. While base graphs can be beautiful creations, we recommend spending the most time learning about ggplot2 . This section is here for completeness and because base graphics are just needed, especially for modifying the plots generated by other functions.
Before we can go any further we need some data. Most of the datasets built into R are tiny, even by standards from ten years ago. A good dataset for example graphs is, ironically, included with ggplot2. In order to access it, ggplot2 must first be installed and loaded. Then the diamonds data can be loaded and inspected.
Base Histograms

hist(diamonds$carat, main = “Carat Histogram”, xlab = “Carat”)

R Data Visualization training Chennai

R histogram Visualisation

Base Scatterplot
plot(price ~ carat, data = diamonds)
R Data Visualization training in chennai
ggplot2
While R’s base graphics are extremely powerful and flexible and can be customized to a great extent, using them can be labor intensive. Two packages—ggplot2 and lattice—were built to make graphing easier. Over the past few years ggplot2 has far exceeded lattice in popularity and features.
Initially, the ggplot2 syntax is harder to grasp, but the effort is more than worthwhile. It is much easier to delineate data by color, shape, or size and add legends with ggplot2. Graphs are quicker to build. Graphs that could take 30 lines of code with base graphics are possible with just one line in ggplot2.
The basic structure for ggplot2 starts with the ggplot function,which at its most basic should take the data as its first argument. It can take more arguments, or fewer, but we will stick with that for now. After initializing the object, we add layers using the + symbol. To start, we will just discuss geometric layers such as points, lines and histograms. They are included using functions like geom point, geom line and geom histogram. These functions take multiple arguments, the most important being which variable in the data gets mapped to which axis or other aesthetic using aes. Furthermore, each layer can have different aesthetic mappings and even different data.
ggplot2 Histograms and Densities
ggplot(data = diamonds) + geom_histogram(aes(x = carat))
R Data Visualization training in chennai
Do You sense the aesthetic difference from the base graphic package ?
A similar display is the density plot, which is done by changing geom histogram to geom density. We also specify the color to fill in the graph using the fill argument. This differs from the color argument that we will see later. Also notice that the fill argument was entered outside the aes function. This is because we want the whole graph to be that color. We will see how it can be used inside aes later.

ggplot(data = diamonds) + geom_density(aes(x = carat), fill = “grey50”)

R Data Visualization training in chennai

R Visualization gggplot density plot

 ggplot2 Scatterplots
ggplot(diamonds, aes(x = carat, y = price)) + geom_point()
g + geom_point(aes(color = color))
R Data Visualization training in chennai
Themes
A great part of ggplot2 is the ability to use themes to easily change the way plots look. While building a theme from scratch can be daunting, Jeffrey Arnold from the University of Rochester has put together ggthemes, a package of themes to re-create commonly used styles of graphs. Just a few styles—The Economist, Excel, Edward Tufte and The Wall Street Journal
require(ggthemes)
> # build a plot and store it in g2
> g2 <- ggplot(diamonds, aes(x=carat, y=price)) +
+     geom_point(aes(color=color))
> # apply a few themes
> g2 + theme_economist() + scale_colour_economist()
> g2 + theme_excel() + scale_colour_excel()
> g2 + theme_tufte()
> g2 + theme_wsj()
R Data Visualization training in chennai

 

R Data Visualization training in chennai

We have seen both basic graphs and ggplot graphs that are both nicer and easier to create. We have covered histograms, scatterplots, boxplots, line plots and density graphs. We have also looked at using colors and small multiples for distinguishing data. There are many other features in ggplot2 such as jittering, stacking, dodging and alpha, which we will demonstrate in our R Visualization Training at Chennai.

Email : info@bigdatatraining.in

Call – +91 97899 68765 / +91 9962774619 / 044 – 42645495

Weekdays / Fast Track / Weekends / Corporate Training modes available

R Data Visualization training is also available across India in Bangalore, Pune, Hyderabad, Mumbai, Kolkata, Ahmedabad, Delhi, Gurgon, Noida, Kochin, Tirvandram, Goa, Vizag, Mysore,Coimbatore, Madurai, Trichy, Guwahati

On-Demand Fast track AWS Cloud Training globally available also at Singapore, Dubai, Malaysia, London, San Jose, Beijing, Shenzhen, Shanghai, Ho Chi Minh City, Boston, Wuhan, San Francisco, Chongqing.

 

Big Data Training Bangalore Hadoop Training in Bangalore, 2013