Grafikler bir veri kümesini anlamamıza yardımcı olur.
Örüntüyü yorumlayabilmek önemli bir güçtür.
Veriyi betimlemek amacıyla
Veriyi betimleyerek başkaları ile paylaşmak amacıyla veri görselleştirmeden yararlanırız.
plot(sleep)
plot(ChickWeight)
plot(ChickWeight$Diet)
library(MASS)
## Warning: package 'MASS' was built under R version 4.0.5
plot(UScereal$sugars, UScereal$Calories)
title("Seker ve Kalori İliskisi")
# Data için paket aktifleştirme
library(MASS)
x <- UScereal$sugars
y <- UScereal$calories
library(grid)
# plot olusturma
pushViewport(plotViewport())
pushViewport(dataViewport(x, y))
grid.rect()
grid.xaxis()
grid.yaxis()
grid.points(x, y)
grid.text("Kalori", x = unit(-3, "lines"), rot = 90)
grid.text("Seker", y = unit(-3, "lines"), rot = 0)
popViewport(2)
library(lattice)
## Warning: package 'lattice' was built under R version 4.0.5
xyplot(sugars ~ calories | vitamins, data = UScereal)
library(ggplot2)
## Warning: package 'ggplot2' was built under R version 4.0.5
title <-
"ggplot2 plot of \n UScereal$calories vs. \n UScereal$sugars"
basePlot <- ggplot(UScereal, aes(x = sugars, y = calories))
basePlot +
geom_point(shape = as.character(UScereal$shelf), size = 3) +
annotate("text", label = title, x = 3, y = 400,
colour = "red")
library(MASS)
plot(Boston$rm, Boston$medv, main = "Scatterplot")
library(MASS)
sunflowerplot(Boston$rad, Boston$tax, main = "Sunflowerplot")
library(MASS)
boxplot(crim ~ rad, data = Boston, log = "y", las = 1,
main = "Boxplot", xlab = "rad", ylab = "crim")
mosaicplot(cyl ~ gear, data = mtcars, main = "Mosaicplot")
en genel fonksiyon plot() nokta eklemek için points() çizgi eklemek için lines() metin eklemek için text() etiket eklemek için label()
ggpubr::show_point_shapes()
## Scale for 'y' is already present. Adding another scale for 'y', which will
## replace the existing scale.
plot(x = mtcars$mpg, y = mtcars$disp, frame = FALSE,
xlab = "MPG", ylab = "DISP")
plot(x = mtcars$mpg, y = mtcars$disp, frame = FALSE,
xlab = "MPG", ylab = "DISP" ,pch=8)
plot(x = mtcars$mpg, y = mtcars$disp, frame = FALSE,
xlab = "MPG", ylab = "DISP" ,pch="a",col="red")
normal <- rnorm(100,50,10)
hist(normal)