Blog

We provide practical tutorials on data mining, visualization and statistics for decision making.

This article describes how to easily compute and explore correlation matrix in R using the corrr package. The corrr package makes it easy to ignore the diagonal, focusing on the correlations of certain variables against others, or reordering and visualizing the correlation matrix. It...

Easy Correlation Matrix Analysis in R Using Corrr Package

This article describes how to easily compute and explore correlation matrix in R using the corrr package. The corrr package makes it easy to ignore the diagonal, focusing on the correlations of certain variables against others, or reordering and visualizing the correlation matrix. It...

This article shows some R histogram examples. Demo data Weight data by sex: set.seed(1234) wdata = data.frame( sex = factor(rep(c("F", "M"), each=200)), weight = c(rnorm(200, 55), rnorm(200, 58)) ) head(wdata, 4) ## sex weight ## 1 F 53.8 ## 2 F 55.3 ## 3...

R Histogram Example Quick Reference

This article shows some R histogram examples. Demo data Weight data by sex: set.seed(1234) wdata = data.frame( sex = factor(rep(c("F", "M"), each=200)), weight = c(rnorm(200, 55), rnorm(200, 58)) ) head(wdata, 4) ## sex weight ## 1 F 53.8 ## 2 F 55.3 ## 3...

Create Icon in R This article describes how to create icon in R with transparent background from a ggplot. Contents: Prerequisites Load ggplot2 and create a helper theme for ggplot icon: library(ggplot2) # Helper theme for ggplot icon theme_icon <- function () { theme_void()...

How to Create Icon in R

Create Icon in R This article describes how to create icon in R with transparent background from a ggplot. Contents: Prerequisites Load ggplot2 and create a helper theme for ggplot icon: library(ggplot2) # Helper theme for ggplot icon theme_icon <- function () { theme_void()...

This article provides a gallery of ggplot examples, including: scatter plot, density plots and histograms, bar and line plots, error bars, box plots, violin plots and more. Contents: Prerequisites Scatter plot Distribution Density plot Histogram QQ Plot Empirical cumulative distribution (ECDF) Density ridgeline plots...

GGPlot Examples Best Reference

This article provides a gallery of ggplot examples, including: scatter plot, density plots and histograms, bar and line plots, error bars, box plots, violin plots and more. Contents: Prerequisites Scatter plot Distribution Density plot Histogram QQ Plot Empirical cumulative distribution (ECDF) Density ridgeline plots...

In this article, you will learn how to map variables in the data to visual properpeties of ggplot geoms (points, bars, box plot, etc). These visual caracteristics are known as aesthetics (or aes) and include: color and fill points shape line type size group...

GGPlot AES: How to Assign Aesthetics in GGPlot2

In this article, you will learn how to map variables in the data to visual properpeties of ggplot geoms (points, bars, box plot, etc). These visual caracteristics are known as aesthetics (or aes) and include: color and fill points shape line type size group...

In this article you will learn how to create a ggplot-like 3D scatter plot using the plotly R package. Contents: Prerequisites Basic 3D Scatter Plot 3D Scatter Plot with Color Scaling Prerequisites Load required R packages library(tidyverse) library(plotly) Data preparation: df <- mtcars %>%...

How to Create a GGPlot-like 3D Scatter Plot using Plotly

In this article you will learn how to create a ggplot-like 3D scatter plot using the plotly R package. Contents: Prerequisites Basic 3D Scatter Plot 3D Scatter Plot with Color Scaling Prerequisites Load required R packages library(tidyverse) library(plotly) Data preparation: df <- mtcars %>%...

In this article, you will learn how to save a ggplot to different file formats, including: PDF, SVG vector files, PNG, TIFF, JPEG, etc. You can either print directly a ggplot into PNG/PDF files or use the convenient function ggsave() for saving a ggplot....

How to Save a GGPlot

In this article, you will learn how to save a ggplot to different file formats, including: PDF, SVG vector files, PNG, TIFF, JPEG, etc. You can either print directly a ggplot into PNG/PDF files or use the convenient function ggsave() for saving a ggplot....

Introduction In this article, you will learn how to modify ggplot labels, including main title, subtitle, axis labels, caption, legend titles and tag. Plot title and subtitle provides insights into the main findings Caption are generally used to describe the data source Tag can...

How to Change GGPlot Labels: Title, Axis and Legend

Introduction In this article, you will learn how to modify ggplot labels, including main title, subtitle, axis labels, caption, legend titles and tag. Plot title and subtitle provides insights into the main findings Caption are generally used to describe the data source Tag can...

This article describes how to subset data when creating a ggplot. Prerequisites Load required packages and set the theme function theme_bw() as the default theme: library(ggplot2) theme_set(theme_bw()) Data preparation Data derived from ToothGrowth data sets are used. ToothGrowth describes the effect of Vitamin C...

How to Subset a Dataset When Plotting with GGPLOT2

This article describes how to subset data when creating a ggplot. Prerequisites Load required packages and set the theme function theme_bw() as the default theme: library(ggplot2) theme_set(theme_bw()) Data preparation Data derived from ToothGrowth data sets are used. ToothGrowth describes the effect of Vitamin C...

In this article, you will learn how to create a horizontal bar plot using the ggplot2 R package. Prerequisites Load required packages and set the theme function theme_bw() as the default theme: library(ggplot2) theme_set(theme_bw()) Data preparation Data derived from ToothGrowth data sets are used....

How to Create a GGPlot Horizontal Bar Chart

In this article, you will learn how to create a horizontal bar plot using the ggplot2 R package. Prerequisites Load required packages and set the theme function theme_bw() as the default theme: library(ggplot2) theme_set(theme_bw()) Data preparation Data derived from ToothGrowth data sets are used....