Witam na mojej stronce. Poniżej zamieszczam wymagane zadanie domowe :).
dane10 <- read.table("E:/R_emisje/EMISJE_R/zasolenie/zasolenie_zaj/dane10.txt", fill = TRUE , header = FALSE)
load("E:/R_emisje/EMISJE_R/zasolenie/zasolenie_zaj/d1.RData")
# Sekwencja do określenia jakie dane mają jakie "cm"
n <- 6
pol_seq <- rep(0:19, each=n)
drug_pol <- rep(19:0, each=n)
sekwencja = c(pol_seq, drug_pol)
# usuwanie wierszy z "cm"
dane10=dane10[dane10$V2 != "cm", ]
# dodajemy kolumne "stan"
dane10$stan = sekwencja
# Zmiana nazw kolumn
colnames(dane10) <- c('data', 'godzina', paste0("el_", 1:11), 'stan')
# Jeśli chcemy wszystko umieścić na wykresie (wszystkie dane) - musimy użyć gather
dd1 <- gather( d1,
key = "xx",
value = "SS",6:13,
na.rm = FALSE,
convert = TRUE,
factor_key = TRUE)p <- ggplot(dd1, aes(as.factor(pol), xx)) +
geom_raster(aes(fill=SS)) +
theme(axis.text.x = element_text(angle = 90, vjust = 0.5)) +
labs(title = "Raster ggplotly",
x="Polozenie",
y="S-ki")
ggplotly(p)ply <- plot_ly(dd1, x = ~pol, y = ~xx , z = ~SS, type = "heatmap") %>%
layout(title = "Wykres rastrowy przy wykorzystaniu plotly",
xaxis = list(title = "Polozenie"),
yaxis = list(title = "S-ki"))
ply