Blog

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

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)) +...

  In this article, you will learn how to set ggplot breaks for continuous x and y axes. The function scale_x_continuous() and scale_y_continuous() can be used for ggplot axis breaks settings. Prerequisites Load the ggplot2 package and set the theme function theme_classic() as the...

How to Set GGPlot Breaks

  In this article, you will learn how to set ggplot breaks for continuous x and y axes. The function scale_x_continuous() and scale_y_continuous() can be used for ggplot axis breaks settings. Prerequisites Load the ggplot2 package and set the theme function theme_classic() as the...

In this article, you will learn how to easily create a histogram by group in R using the ggplot2 package. Prerequisites Load the ggplot2 package and set the theme function theme_classic() as the default theme: library(ggplot2) theme_set( theme_classic() + theme(legend.position = "top") ) Create...

How to Create Histogram by Group in R

In this article, you will learn how to easily create a histogram by group in R using the ggplot2 package. Prerequisites Load the ggplot2 package and set the theme function theme_classic() as the default theme: library(ggplot2) theme_set( theme_classic() + theme(legend.position = "top") ) Create...

You will learn how to plot smooth line using ggplot2. Contents: Prerequisites Key R function: geom_smooth() Regression line Loess method for local regression fitting Polynomial interpolation Spline interpolation Prerequisites Load the ggplot2 package and set the default theme to theme_minimal(): library(ggplot2) theme_set( theme_bw() +...

How to Plot a Smooth Line using GGPlot2

You will learn how to plot smooth line using ggplot2. Contents: Prerequisites Key R function: geom_smooth() Regression line Loess method for local regression fitting Polynomial interpolation Spline interpolation Prerequisites Load the ggplot2 package and set the default theme to theme_minimal(): library(ggplot2) theme_set( theme_bw() +...

There are many R packages/functions for combining multiple ggplots into the same graphics. These include: gridExtra::grid.arrange() and cowplot::plot_grid. Recently, Thomas Lin Pederson developed the patchwork R package to make very easy the creation of ggplot multiple plots In this article, you will learn how...

GGPlot Multiple Plots Made Ridiculuous Simple Using Patchwork R Package

There are many R packages/functions for combining multiple ggplots into the same graphics. These include: gridExtra::grid.arrange() and cowplot::plot_grid. Recently, Thomas Lin Pederson developed the patchwork R package to make very easy the creation of ggplot multiple plots In this article, you will learn how...

This article provide many examples for creating a ggplot map. You will also learn how to create a choropleth map, in which areas are patterned in proportion to a given variable values being displayed on the map, such as population life expectancy or density....

How to Create a Map using GGPlot2

This article provide many examples for creating a ggplot map. You will also learn how to create a choropleth map, in which areas are patterned in proportion to a given variable values being displayed on the map, such as population life expectancy or density....

  This article describes how to change easily ggplot facet labels. Contents: Prerequisites Basic ggplot with facet Change the text of facet labels Customize facet labels appearance Change facet background color Prerequisites Load required packages and set the theme function theme_light() as the...

How to Change GGPlot Facet Labels

  This article describes how to change easily ggplot facet labels. Contents: Prerequisites Basic ggplot with facet Change the text of facet labels Customize facet labels appearance Change facet background color Prerequisites Load required packages and set the theme function theme_light() as the...

This article describes how to install ggplot2 in R. Installing ggplot2 The ggplot2 package can be easily installed using the R function install.packages(). You need to type the following R code in the console: install.packages("ggplot2") The above code will automatically download the ggplot2 package,...

How to Install GGPLOT2 in R

This article describes how to install ggplot2 in R. Installing ggplot2 The ggplot2 package can be easily installed using the R function install.packages(). You need to type the following R code in the console: install.packages("ggplot2") The above code will automatically download the ggplot2 package,...