Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Selected Reading
How to create scatterplot for factor levels in an R data frame?
To create a scatterplot for factor levels, we can use facet_grid function of ggplot2 package. For example, suppose we have a factor column in a data frame df defined as F and numerical columns defined as x and y then the scatterplot for the factor levels can be created as −
ggplot(df,aes(x,y))+geom_point()+facet_grid(~Factor)
Example
library(ggplot2) ggplot(df,aes(x,y))+geom_point()+facet_grid(~Factor)
Output

Advertisements
