Closed adamhsparks closed 4 years ago
Hey @adamhsparks,
Thanks for the suggestion! I tend towards recommending the following code for a viridis colour palette, instead of including another dependency for clifro, but let me know what you think:
library(clifro)
library(ggplot2)
# Create example data set
wind_df = data.frame(wind_speeds = c(rweibull(80, 2, 4), rweibull(20, 3, 9)),
wind_dirs = c(rnorm(80, 135, 55), rnorm(20, 315, 35)) %% 360,
station = rep(rep(c("Station A", "Station B"), 2),
rep(c(40, 10), each = 2)))
# Create default windrose
my_windrose = with(wind_df, windrose(wind_speeds, wind_dirs,
speed_cuts = c(0, .5, 2, 4, 8, 10, Inf)))
my_windrose
# Create windrose with the viridis colour palette
my_windrose +
scale_fill_viridis_d(name = "Wind Speed")
Hmm, I thought tried that, maybe I tried scale_colour_*
not scale_fill_*
?
Let me give that a go. Much easier.
On Tue, 10 Mar 2020 at 08:48, Blake Seers notifications@github.com wrote:
Hey @adamhsparks https://github.com/adamhsparks,
Thanks for the suggestion! I tend towards recommending the following code for a viridis colour palette, instead of including another dependency for clifro, but let me know what you think:
library(clifro) library(ggplot2)
Create example data set
wind_df = data.frame(wind_speeds = c(rweibull(80, 2, 4), rweibull(20, 3, 9)), wind_dirs = c(rnorm(80, 135, 55), rnorm(20, 315, 35)) %% 360, station = rep(rep(c("Station A", "Station B"), 2), rep(c(40, 10), each = 2)))
Create windrose with the viridis colour palette
my_windrose = with(wind_df, windrose(wind_speeds, wind_dirs, speed_cuts = c(0, .5, 2, 4, 8, 10, Inf)))
my_windrose
[image: default_windrose] https://user-images.githubusercontent.com/5362994/76263780-e9d5ea80-62b3-11ea-8949-b05bc9bd2a2b.png
my_windrose + scale_fill_viridis_d(name = "Wind Speed")
[image: viridis_windrose] https://user-images.githubusercontent.com/5362994/76263812-007c4180-62b4-11ea-9d5c-14d72e23c5e1.png
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ropensci/clifro/issues/24?email_source=notifications&email_token=AAYMIAV75LCPJFHGHRZU6O3RGVW3PA5CNFSM4LDO7472YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEOJK6GA#issuecomment-596815640, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAYMIAUQRC3EAHR3ASO6GOTRGVW3PANCNFSM4LDO747Q .
-- Dr Adam H. Sparks http://adamhsparks.netlify.com/ Associate Professor of Field Crops Pathology | Centre for Crop Health | Office C313
Phone (+61) 07 46311948 | Mobile 0415 489 422 | Twitter @adamhsparks https://twitter.com/adamhsparks
Institute for Life Sciences and the Environment | Research and Innovation Division University of Southern Queensland | Toowoomba, Queensland | 4350 | Australia
Yep. Just me making a mistake! Thanks.
On Tue, 10 Mar 2020 at 08:50, Adam H Sparks adamhsparks@gmail.com wrote:
Hmm, I thought tried that, maybe I tried scalecolour* not scalefill?
Let me give that a go. Much easier.
On Tue, 10 Mar 2020 at 08:48, Blake Seers notifications@github.com wrote:
Hey @adamhsparks https://github.com/adamhsparks,
Thanks for the suggestion! I tend towards recommending the following code for a viridis colour palette, instead of including another dependency for clifro, but let me know what you think:
library(clifro) library(ggplot2)
Create example data set
wind_df = data.frame(wind_speeds = c(rweibull(80, 2, 4), rweibull(20, 3, 9)), wind_dirs = c(rnorm(80, 135, 55), rnorm(20, 315, 35)) %% 360, station = rep(rep(c("Station A", "Station B"), 2), rep(c(40, 10), each = 2)))
Create windrose with the viridis colour palette
my_windrose = with(wind_df, windrose(wind_speeds, wind_dirs, speed_cuts = c(0, .5, 2, 4, 8, 10, Inf)))
my_windrose
[image: default_windrose] https://user-images.githubusercontent.com/5362994/76263780-e9d5ea80-62b3-11ea-8949-b05bc9bd2a2b.png
my_windrose + scale_fill_viridis_d(name = "Wind Speed")
[image: viridis_windrose] https://user-images.githubusercontent.com/5362994/76263812-007c4180-62b4-11ea-9d5c-14d72e23c5e1.png
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ropensci/clifro/issues/24?email_source=notifications&email_token=AAYMIAV75LCPJFHGHRZU6O3RGVW3PA5CNFSM4LDO7472YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEOJK6GA#issuecomment-596815640, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAYMIAUQRC3EAHR3ASO6GOTRGVW3PANCNFSM4LDO747Q .
-- Dr Adam H. Sparks http://adamhsparks.netlify.com/ Associate Professor of Field Crops Pathology | Centre for Crop Health | Office C313
Phone (+61) 07 46311948 | Mobile 0415 489 422 | Twitter @adamhsparks https://twitter.com/adamhsparks
Institute for Life Sciences and the Environment | Research and Innovation Division University of Southern Queensland | Toowoomba, Queensland | 4350 | Australia
-- Dr Adam H. Sparks http://adamhsparks.netlify.com/ Associate Professor of Field Crops Pathology | Centre for Crop Health | Office C313
Phone (+61) 07 46311948 | Mobile 0415 489 422 | Twitter @adamhsparks https://twitter.com/adamhsparks
Institute for Life Sciences and the Environment | Research and Innovation Division University of Southern Queensland | Toowoomba, Queensland | 4350 | Australia
I've been using the
windrose()
for a publication that I'm working on and most of our figures use the viridis colour scale. I find the yellow just easier to see in viridis palette. So I modified the function to allow using the viridis palettes in windrose plots along with the RColorBrewer palettes currently supported. I'm happy to send through a PR if you're interested?https://github.com/adamhsparks/clifro/commit/5779e55d2c3e5d44f16736e091115f4df319fbeb