Display Only Values in Plot in R (Examples) | Base R & ggplot2 Scatterplot | geom_point & geom_text
Автор: Statistics Globe
Загружено: 3 февр. 2022 г.
Просмотров: 294 просмотра
How to show only text labels in a scatterplot in the R programming language. More details: https://statisticsglobe.com/display-o...
R code of this video:
set.seed(5639478) # Create example data
data <- data.frame(x = 1:100,
y = round(rnorm(100, 5, 2), 1))
plot(x = data$x, # Default plot using Base R
y = data$y)
plot(x = data$x, # Plot with text using Base R
y = data$y,
type = "n")
text(x = data$x,
y = data$y,
labels = data$y)
install.packages("ggplot2") # Install & load ggplot2 package
library("ggplot2")
ggplot(data, aes(x, y, label = y)) + # Default plot using ggplot2
geom_point()
ggplot(data, aes(x, y, label = y)) + # Plot with text using ggplot2
geom_text()
Follow me on Social Media:
Facebook – Statistics Globe Page: / statisticsglobecom
Facebook – Group for Discussions & Questions: / statisticsglobe
LinkedIn – Statistics Globe Page: / statisticsglobe
LinkedIn – Group for Discussions & Questions: / 12555223
Twitter: / joachimschork
Music by bensound.com

Доступные форматы для скачивания:
Скачать видео mp4
-
Информация по загрузке: