Code
plot(rivers)
plot(rivers)
plot(cars, main='Prędkość i odległość do zatrzymania samochodu',xlab='Prędkość', ylab='Odległość')
plot(iris[-5],col=iris[,5])
plot(chickwts$weight~chickwts$feed)
plot(AirPassengers)
plot(Titanic)
plot(Titanic,shade=TRUE)
library(TeachingDemos)
plot(dice(12,4))
hist(rivers, main = '')
hist(rivers,breaks=c(0,400,800,1200,2000,4000),xlab='Długość w milach',ylab='Gęstość',main='')
par(mfrow=c(2,1))
dotchart(VADeaths)
dotchart(t(VADeaths))
par(mfrow=c(2,1))
barplot(VADeaths,
col = c("blue", "lightblue", "lightcyan",
"lavender", "pink"),
legend = rownames(VADeaths))
barplot(VADeaths,
col = c("blue", "lightblue", "lightcyan",
"lavender", "pink"),
legend = rownames(VADeaths), beside = TRUE)
pie(table(mtcars$gear),labels=c('3 biegi','4 biegi', '5 biegów'),main='')
# Umieszczenie kilku wykresów w jednym obszarze graficznym.
library(ggplot2)
par(mfrow=c(4,1))
plot(price ~ carat, data = diamonds, xlab = "Waga (karaty)", ylab = "Cena", col = "darkblue", pch = 20)
hist(diamonds$price, breaks = 30, col = "skyblue", main='', xlab = "Cena", ylab = "Liczba diamentów")
boxplot(price ~cut , data = diamonds, xlab = "Typ szlifu", ylab = "Cena", col = c("#FF9999", "#FFCC99", "#FFFF99", "#CCFF99", "#99FF99"))
<- tapply(diamonds$price, diamonds$color, mean)
avg_price barplot(avg_price, xlab = "Kolor", ylab = "Średnia cena", ylim=c(0,7000),col = viridis::viridis(length(avg_price)))
legend("topleft", legend = names(avg_price), fill = viridis::viridis(length(avg_price)))
<- heat.colors(5) # paleta z 5 kolorami
paleta<- seq(0, 2*pi, length.out=100)
x <- seq(0, 2*pi, length.out=100)
y <- outer(x, y, function(x, y) sin(x)*sin(y))
z heatmap(z, Colv=NA, Rowv=NA, col=paleta, scale="none", xlab="", ylab="", labRow = FALSE, labCol = FALSE)
<- topo.colors(8) # paleta z 8 kolorami
paleta<- seq(0, 2*pi, length.out=100)
x <- seq(0, 2*pi, length.out=100)
y <- outer(x, y, function(x, y) sin(x)*sin(y))
z heatmap(z, Colv=NA, Rowv=NA, col=paleta, scale="none", xlab="", ylab="", labRow = FALSE, labCol = FALSE)
<- cm.colors(8) # paleta z 8 kolorami
paleta<- seq(0, 2*pi, length.out=100)
x <- seq(0, 2*pi, length.out=100)
y <- outer(x, y, function(x, y) sin(x)*sin(y))
z heatmap(z, Colv=NA, Rowv=NA, col=paleta, scale="none", xlab="", ylab="", labRow = FALSE, labCol = FALSE)
<- terrain.colors(6) # paleta z 6 kolorami
paleta<- seq(0, 2*pi, length.out=100)
x <- seq(0, 2*pi, length.out=100)
y <- outer(x, y, function(x, y) sin(x)*sin(y))
z heatmap(z, Colv=NA, Rowv=NA, col=paleta, scale="none", xlab="", ylab="", labRow = FALSE, labCol = FALSE)
<- rainbow(20)
paleta<- seq(0, 8*pi, length.out=100)
x <- seq(0, 8*pi, length.out=100)
y <- outer(x, y, function(x, y) sin(x)*sin(y))
z heatmap(z, Colv=NA, Rowv=NA, col=paleta, scale="none", xlab="", ylab="", labRow = FALSE, labCol = FALSE)
library(RColorBrewer)
<- seq(0, 2*pi, length.out=100)
x <- seq(0, 2*pi, length.out=100)
y <- outer(x, y, function(x, y) sin(x)*sin(y))
z <- brewer.pal(9, "RdYlBu")
palette heatmap(z, Colv=NA, Rowv=NA, col=palette, scale="none", xlab="", ylab="", labRow = FALSE, labCol = FALSE)
library(viridis)
<- y <- seq(-2*pi, 2*pi, len = 80)
x <- sqrt(outer(2*x^2, y^2, "+"))
r filled.contour(sin(r^2)*exp(-r/(68*pi)),
axes=FALSE,
color.palette=viridis,
asp=1)
library(wesanderson)
<- seq(0, 4*pi, length.out=100)
x <- seq(0, 4*pi, length.out=100)
y <- outer(x, y, function(x, y) sin(x)*sin(y))
z <- wes_palette("GrandBudapest1", n = 4)
palette heatmap(z, Colv=NA, Rowv=NA, col=palette, scale="none", xlab="", ylab="", labRow = FALSE, labCol = FALSE)
library(colorspace)
<- seq(0, 4*pi, length.out=100)
x <- seq(0, 4*pi, length.out=100)
y <- outer(x, y, function(x, y) sin(x)*sin(y))
z <- sequential_hcl(20, palette = "Blues")
palette heatmap(z, Colv=NA, Rowv=NA, col=palette, scale="none", xlab="", ylab="", labRow = FALSE, labCol = FALSE)