Plotting level plot in R -
i have 12 variables, m1, m2, ..., m12, compute statistic x.
df = data.frame(model = paste("m", 1:28, sep = ""), x = runif(28, 1, 1.05)) levels = seq(0.8, 1.2, 0.05)
i plot data follows:
each circle (contour) represents level of statistic "x". 3 blue lines represent 3 different scenarios. dataframe included in example represents 1 scenario. blue line join values of models m1 m28 specific scenario.
is there tool in r allow such plot? tried contour()
library(mass)
contours not drawn perfect circles.
any appreciated. thanks!
here ggplot solution:
library(ggplot2) ggplot(data=df, aes(x=model, y=x, group=1)) + geom_line() + coord_polar() + scale_y_continuous(limits=range(levels), breaks=levels, labels=levels)
note little confusing because of names in data frame. x
y variable here, , model real x
, graph scale label seems odd.
edit: had set factor levels model
in data frame plot in correct order.
Comments
Post a Comment