Search code examples
ropenairwindrose

Removing statistics, title and increase legend size from openair windRose


I have produced a windRose using openair but when I change to annotate = F I lose all of the directions but I just want to remove the title and stats (circled in red in image). I also want to increase scale size so that my text is not squished.

Current code is

windRose(wind_rose_feb_apr_2008_2022, ws = "Speed", wd = "Direction",
              breaks = c(0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55),
              auto.text = T, paddle = FALSE,
              max.freq = 25, angle = 22.5, annotate = T, cols = "jet", key.position = "bottom",
              key.header = "Wind Speed (knots)", key.footer = " ", offset=5) 

annotate F results in cardinal directions being remove as well


Solution

  • I couldn't find a way to hack the windRose function to show only the cardinal directions. However, with a bit of help from the openair book at: https://bookdown.org/david_carslaw/openair/sections/appendices/appendix-annotate.html you can remove the annotations and then add the cardinal directions:

    library(openair)
    library(latticeExtra)
    
    windRose(mydata,
             annotate = FALSE)
    trellis.last.object() +
      layer(panel.abline(v = 0, lty = 1), rows = 1) +
      layer(panel.abline(h = 0, lty = 1), rows = 1) +
      layer(ltext(x = c(0.75, 18, 0.75, -18), y = c(18, 0.75, -18, 0.75),
                  labels = c("N", "E", "S", "W"), srt = 0, cex = 0.75), rows = 1)
    

    Created on 2023-07-28 with reprex v2.0.2