# Blog

We provide practical tutorials on data mining, visualization and statistics for decision making. 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.... This article describes how to create a pie chart and donut chart using the ggplot2 R package. Pie chart is just a stacked bar chart in polar coordinates. The function coord_polar() is used to produce pie chart from a bar plot. Contents: Prerequisites Load...

#### How to Create a Pie Chart in R using GGPLot2

This article describes how to create a pie chart and donut chart using the ggplot2 R package. Pie chart is just a stacked bar chart in polar coordinates. The function coord_polar() is used to produce pie chart from a bar plot. Contents: Prerequisites Load... In this article, you will learn how to create a bubble chart in R using the ggplot2 package. Prerequisites Load the ggplot2 package and set the theme function theme_bw() as the default theme: library(ggplot2) theme_set( theme_bw() + theme(legend.position = "top") ) Data preparation Demo...

#### How to Create a Bubble Chart in R using GGPlot2

In this article, you will learn how to create a bubble chart in R using the ggplot2 package. Prerequisites Load the ggplot2 package and set the theme function theme_bw() as the default theme: library(ggplot2) theme_set( theme_bw() + theme(legend.position = "top") ) Data preparation Demo... In this article, you will learn how to change a ggplot legend order. Prerequisites Load the ggplot2 package and set the theme function theme_classic() as the default theme: library(ggplot2) theme_set( theme_classic() ) Basic plots p <- ggplot(iris, aes(x = Species, y = Sepal.Length)) +...

#### How to Change GGPlot Legend Order

In this article, you will learn how to change a ggplot legend order. Prerequisites Load the ggplot2 package and set the theme function theme_classic() as the default theme: library(ggplot2) theme_set( theme_classic() ) Basic plots p <- ggplot(iris, aes(x = Species, y = Sepal.Length)) +...