Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 205301

Time series vectors of quarter plot

$
0
0

I think my plot looks a bit silly, can u help me out? It's actually my second plot, what i think looks weird, but you probably need information of this first lines of code as well.

first_dif <- c(temp_ym$Temp, 0) - c(0, temp_ym$Temp)
first_dif <- c(first_dif[2:120])
first_dif <- c(NA, first_dif) 
first_difQuarter <- data.frame(Quarter = temp_ym$Quarter, 
                               first_dif = first_dif, 
                               Season = temp_ym$Season)

ggplot() +
  scale_y_discrete(breaks = seq(-5, 5, by = 0.5)) + 
  ylim(c(-5,5)) +
  geom_line(data = first_difQuarter, aes(x = Quarter, y = first_dif), color = "darkblue") +
  geom_hline(yintercept = 0, color = "red") +
  theme_bw() +
  ggtitle('Historische temperatuur data van Australia van 01-1981 tot 12-1990 per maand')
first_difQuarter2 <- mutate(first_difQuarter, Year = year(temp_ym$Date))

ggplot(data = first_difQuarter2, aes(x = Year, y = first_dif, color = as.character(Season))) + 
  geom_line(size = 0.75) + 
  theme_bw() + 
  scale_y_discrete(breaks = seq(-5, 5, by = 0.5)) + 
  ylim(c(-5,5)) +
  scale_color_manual(values = c("blue", "red", "springgreen3", "black"), 
                     name = NULL, labels = c("Q1", "Q2", "Q3", "Q4")) +
  theme(legend.position = c(0.7, 0.85),
        legend.direction = "vertical")

enter image description here


Viewing all articles
Browse latest Browse all 205301

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>