## R Graphics

Graphics play an important role in carrying out the important features of the data. Graphics are used to examine marginal distributions, relationships between variables, and summary of very large data. It is a very important complement for many statistical and computational techniques.

### Standard Graphics

R standard graphics are available through package graphics, include several functions which provide statistical plots, like:

- Scatterplots
- Piecharts
- Boxplots
- Barplots etc.

We use the above graphs that are typically a single function call.

### Graphics Devices

It is something where we can make a plot to appear. A graphics device is a window on your computer (screen device), a PDF file (file device), a Scalable Vector Graphics (SVG) file (file device), or a PNG or JPEG file (file device).

**There are some of the following points which are essential to understand:**

- The functions of graphics devices produce output, which depends on the active graphics device.
- A screen is the default and most frequently used device.
- R graphical devices such as the PDF device, the JPEG device, etc. are used.
- We just need to open the graphics output device which we want. Therefore, R takes care of producing the type of output which is required by the device.
- For producing a certain plot on the screen or as a GIF R graphics file, the R code should exactly be the same. We only need to open the target output device before.
- Several devices can be open at the same time, but there will be only one active device.

### The basics of the grammar of graphics

There are some key elements of a statistical graphic. These elements are the basics of the grammar of graphics. Letâ€™s discuss each of the elements one by one to gain the basic knowledge of graphics.

**1) Data**

Data is the most crucial thing which is processed and generates an output.

**2) Aesthetic Mappings**

Aesthetic mappings are one of the most important elements of a statistical graphic. It controls the relation between graphics variables and data variables. In a scatter plot, it also helps to map the temperature variable of a data set into the X variable.

In graphics, it helps to map the species of a plant into the color of dots.

**3) Geometric Objects**

Geometric objects are used to express each observation by a point using the aesthetic mappings. It maps two variables in the data set into the x,y variables of the plot.

**4) Statistical Transformations**

Statistical transformations allow us to calculate the statistical analysis of the data in the plot.The statistical transformation uses the data and approximates it with the help of a regression line having x,y coordinates, and counts occurrences of certain values.

**5) Scales**

It is used to map the data values into values present in the coordinate system of the graphics device.

**6) Coordinate system**

The coordinate system plays an important role in the plotting of the data.

- Cartesian
- Plot

**7) Faceting**

Faceting is used to split the data into subgroups and draw sub-graphs for each group.

## Advantages of Data Visualization in R

**1. Understanding**

It can be more attractive to look at the business. And, it is easier to understand through graphics and charts than a written document with text and numbers. Thus, it can attract a wider range of audiences. Also, it promotes the widespread use of business insights that come to make better decisions.

**2. Efficiency**

Its applications allow us to display a lot of information in a small space. Although, the decision-making process in business is inherently complex and multifunctional, displaying evaluation findings in a graph can allow companies to organize a lot of interrelated information in useful ways.

**3. Location**

Its app utilizing features such as Geographic Maps and GIS can be particularly relevant to wider business when the location is a very relevant factor. We will use maps to show business insights from various locations, also consider the seriousness of the issues, the reasons behind them, and working groups to address them.

## Disadvantages of Data Visualization in R

**1. Cost**

R application development range a good amount of money. It may not be possible, especially for small companies, that many resources can be spent on purchasing them. To generate reports, many companies may employ professionals to create charts that can increase costs. Small enterprises are often operating in resource-limited settings, and are also receiving timely evaluation results that can often be of high importance.

**2. Distraction**

However, at times, data visualization apps create highly complex and fancy graphics-rich reports and charts, which may entice users to focus more on the form than the function. If we first add visual appeal, then the overall value of the graphic representation will be minimal. In resource-setting, it is required to understand how resources can be best used. And it is also not caught in the graphics trend without a clear purpose.