rplotcorrelationnegative-numberopenair

Taylor diagram with negative correlation (left quadrant)


I am trying to plot a Taylor diagram in R. The data I am working with give negative correlations. These should be plotted on the left quadrant of a Taylor diagram, but this is not happening with the package I am using called openair.

It seems that this package does not have this option. I have searched for other options without much success.

Is there any other way I can make such a plot in R?

Here's a sample code,

library(openair)

# Generate some data
obs = runif(3, min=5, max=20)
mod1 = obs * -obs^2 # to give a negative correlations
mod2 = obs * obs^2

df = data.frame(obs,mod1,mod2)

# Plot the diagram
taylor1 = TaylorDiagram(df, obs = "obs", mod = "mod1",normalise=TRUE) # mod1 is not plotted

taylor2 = TaylorDiagram(df, obs = "obs", mod = "mod2",normalise=TRUE) # mod2 is plotted

Thanks, Michel


Solution

  • There is also taylor.diagram() from plotrix package

    library(plotrix)
    
    set.seed(20191130)
    
    # Generate some data
    obs = runif(3, min=5, max=20)
    mod1 = obs * -obs^2 # to give a negative correlations
    mod2 = obs * obs^2
    
    # Plot the diagram
    taylor.diagram(obs, mod1, pos.cor = FALSE, normalize = TRUE)
    taylor.diagram(obs, mod2, add = TRUE, col = "blue", normalize = TRUE)
    

    Created on 2019-11-30 by the reprex package (v0.3.0)