Skip to content

Instantly share code, notes, and snippets.

@cavedave
Created July 1, 2021 20:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cavedave/c6744d6bcbbd0b872e1406acc4bee509 to your computer and use it in GitHub Desktop.
Save cavedave/c6744d6bcbbd0b872e1406acc4bee509 to your computer and use it in GitHub Desktop.
df <-
readr::read_csv("https://projects.oregonlive.com/weather/pdx_temps.csv")
#Jun$Temp <- cut(Jun$tmax, breaks=c(50,104, Inf), labels=c("50","100+"))
Jun$Temp <- cut(Jun$tmax, breaks=c(50,60,70,80,90,100, Inf), labels=c("50","60","70","80","90","100+"))
hot <- c("#6BBCD1","#fed976","#feb24c","#fd8d3c","#fc4e2a","#e31a1c","#b10026","#FF2A24")
#hot <- c("#000000","#FF2A24")
library(ggplot2)
# Basic scatter plot , color=Temp alpha = 0.2,
p<-ggplot(Jun, aes(x=year, y=tmax , color=Temp )) + geom_point(size = 1, position = position_jitter(w = 0.00, h = .2) )#
p=p+ggtitle("Maximum Temperature Each June Day in Portland Oregon") +xlab("Year") + ylab("Max Temp °F")
#p=p+geom_smooth(method=loess, colour="black")
#p=p + geom_jitter()
# To use for line and point colors, add
p=p + scale_x_continuous(name="Year", limits=c(1936,2023), expand = c(0, 0))
p=p + scale_colour_manual(values=hot)
p=p + annotate("text", x = 2013, y = 53, label = "data oregonlive by @iamreddave",colour = "black", size=2.2)
p=p + scale_y_continuous(
"Max Temp °F",
sec.axis = sec_axis(~ (. -32) * 5/9, name = "Max Temp °C")
)
p=p + theme_bw()
p=p+theme(plot.title = element_text(hjust = 0.5),legend.position = "none")
p
ggsave("HotPortC.png")
@cavedave
Copy link
Author

cavedave commented Jul 1, 2021

HotPortC
HotPort2

@cavedave
Copy link
Author

cavedave commented Jul 1, 2021

HotPortL

@cavedave
Copy link
Author

cavedave commented Jul 1, 2021

allPort

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment