Linguagem R:Gráficos
Índice
Gráficos Básicos do R
Plot
plot(=nome da variável=)
Gráfico simples
c <- c(3991,1059,493,287,184,131,113,85,64,65,41,47,32,28,21) plot(c)
c <- (10,20,30,20,14,30) freq <- table(c) plot(freq) # ORDENAR DO MAIOR PARA O MENOR freq <- sort(freq, decreasing=TRUE) plot(freq) Legenda na Verticalpar(las=1) plot(freq) DispersionDados padrão do R para exemplos # Cria um modelo de dados my_data <- mtcars # Mostra as seis primeiras linhas head(my_data, 6) plot(x = my_data$wt, y = my_data$mpg,
pch = 16, frame = FALSE,
xlab = "wt", ylab = "mpg", col = "#2E9FDF")
Bar Plotbarplot(=nome da variável=) GGPLOT2Pacotes# Installation
install.packages('ggplot2')
# Loading
library(ggplot2)
[1] Salvando gráfico em arquivoPNGTemperature = c(15,15,15,15,20,21,12,32,23,33,32,19,54) png(file="d:/lixo/saving_plot2.png", width=600, height=350) hist(Temperature, col="gold") dev.off() |