Search code examples
raxis-labelsopenairwindrose

How to change the axis labels from NESW to NOSW in the windRose function from the openair package?


I am trying to change the axis labels for the cardinal points from the windrose plot from NESW to NOSW as I want to present my graph in German. Is there a simple way to do so?

I took the whole code from the windRose function and changed the part axislabs <- c("N", "E", "S", "W") to axislabs <- c("N", "O", "S", "W") in Line 410. I then saved it under a new name windRose_D. I've downloaded the package lattice but I still get the error: Error in checkNum(mydata, vars = c(ws, wd)) : could not find function "checkNum". I don't know where I can find the package with the checkNum function...

Is there maybe a easier way to change the axis labels without changing the complete function?


Solution

  • I don't think there is a simple way of passing a parameter to windRose, but you can modify the function itself. By trial and error, using the body function to modify the elements of windRose, we can do the following...

    library(openair)
    
    body(windRose)[[70]][[3]][["panel"]][[3]][[11]][[3]][[9]][[4]][[2]][[3]][[3]] <- "O"
    
    windRose(mydata)
    

    enter image description here