Highlight subset of data in a plot using ggplot2

Published: 18 May 2023
on channel: Rajendra Choure
556
22

#rprogramming #datavisualization #ggplot2 #highlight #subset

In this video, I have demonstrated the use of function subset() inside geom to get a subset of the data highlighted in te plot. Rearrangement of the layers also has been discussed with adjustments to alpha to make the highlighting effective.
the code

library(palmerpenguins)

head(penguins)
summary(penguins)


library(ggplot2)
ggplot(penguins,aes(flipper_length_mm,body_mass_g,color=species))+
geom_point(data=subset(penguins,island=="Biscoe"), color="red",size=3)+
geom_point()+
theme_classic()


subset(penguins,island=="Biscoe")
Facebook page:
  / rajendrachoureisc  

Mail Id:
rajuchoure@gmail.com

youtube playlist:
   • R programming tutorials  


On this page of the site you can watch the video online Highlight subset of data in a plot using ggplot2 with a duration of hours minute second in good quality, which was uploaded by the user Rajendra Choure 18 May 2023, share the link with friends and acquaintances, this video has already been watched 556 times on youtube and it was liked by 22 viewers. Enjoy your viewing!