Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Visualization graphs, Huge information is being collected through data in the business world, we must need a tool to picture of that data so we can interpret it and make decisions on time.

Data visualization provides a clear idea of what the information means by giving it visual context through maps or graphs.

Visualization allows humans to identify trends, patterns, and anomalies from large datasets.

PCA in R

## ggside

In this tutorial we are going to explain one of the new packages ggside with ggplot.

ggside mainly used for creating customizable side plots with the help of ggplot.

If you want to install the package you can directly install from gitgub.

library(devtools)
devtools::install_github("jtlandis/ggside")

library(ggside)
library(tidyverse)
library(tidyquant)

geom_xside* allows you to place geometries along the x-axis and geom_yside* allows placement along the y-axis.

All of the geom_*side* functions provide a variation on the color aesthetics color/fill.

The variants are named xcolour and xfill or ycolour and yfill for their respective xside or yside geoms.

Stock prediction in R

The following geoms are currently available to use right away from the ggside package.

• GeomBar
• GeomBoxplot
• GeomDensity
• GeomFreqpoly
• GeomHistogram
• GeomLine
• GeomPath
• GeomPoint
• GeomText
• GeomTile
• GeomViolin

In this tutorial, we are exploring only GeomDensity and GeomBoxplot.

### Side Density Plot

geom_xsidedensity() function will create a density plot in top parallel to x-axis of the ggplot. In the same way, geom_ysidedensity () function will create a density plot parallel to the y-axis.

p2<-mpg %>%
ggplot(aes(hwy, cty, color = class)) +
geom_point(size = 2, alpha = 0.3) +
geom_smooth(aes(color = NULL), se=TRUE) +
geom_xsidedensity(
aes(
y    = after_stat(density),
fill = class
),
alpha    = 0.5,
size     = 1,
position = "stack"
) +
geom_ysidedensity(
aes(
x    = after_stat(density),
fill = class
),
alpha    = 0.5,
size     = 1,
position = "stack"
) +
scale_color_tq() +
scale_fill_tq() +
theme_tq() +
labs(title = "Fuel Economy by Vehicle Type" ,
subtitle = "Density Plot",
x = "Highway", y = "City") +  theme(
ggside.panel.scale.x = 0.4,
ggside.panel.scale.y = 0.4
)
plot(p2)

KNN Algorithm in R

##### Xside placed bottom, Yside placed left
p2 + ggside(x.pos = "bottom", y.pos = "left") +
labs(title = "FacetNull", subtitle = "Xside placed bottom, Yside placed left")

##### Collapsing X side Panels
p2 + facet_wrap(drv~fl) +
labs(title = "FacetWrap", subtitle = "Collapsing X side Panels") +
ggside(collapse = "x")

##### Collapsing All Side Panels
p2 + facet_grid(drv~fl, space = "free", scales = "free") +
labs(title = "FacetGrid", subtitle = "Collapsing All Side Panels") +

ggside(collapse = "all")

### Side Boxplot

mpg %>%
ggplot(aes(x = cty, y = hwy, color = class)) +
geom_point() +
geom_smooth(aes(color = NULL)) +
geom_xsideboxplot(
alpha    = 0.5,
size     = 1  ) +
scale_color_tq() +
scale_fill_tq() +
theme_tq() +
facet_grid(cols = vars(cyl), scales = "free_x") +
labs( title = "Fuel Economy by Engine Size")


Data visualization can help by delivering data in the most efficient way possible. Better visualization provides to make better decisions and predictions.

Decision Trees in R

The post Visualization Graphs-ggside with ggplot appeared first on finnstats.