Diagrammes en radar avancés pour ggplot2 (Enhanced Radar Plots for ggplot2)
Most of the code is from https://rstudio-pubs-static.s3.amazonaws.com/5795_e6e6411731bb4f1b9cc7eb49499c2082.html.
ggradar( plot.data, base.size = 15, font.radar = "sans", values.radar = c("0%", "50%", "100%"), axis.labels = colnames(plot.data)[-1], grid.min = 0, grid.mid = 0.5, grid.max = 1, centre.y = grid.min - ((1/9) * (grid.max - grid.min)), plot.extent.x.sf = 1, plot.extent.y.sf = 1.2, x.centre.range = 0.02 * (grid.max - centre.y), label.centre.y = FALSE, grid.line.width = 0.5, gridline.min.linetype = "longdash", gridline.mid.linetype = "longdash", gridline.max.linetype = "longdash", gridline.min.colour = "grey", gridline.mid.colour = "#007A87", gridline.max.colour = "grey", grid.label.size = 6, gridline.label.offset = -0.1 * (grid.max - centre.y), label.gridline.min = TRUE, label.gridline.mid = TRUE, label.gridline.max = TRUE, axis.label.offset = 1.15, axis.label.size = 5, axis.line.colour = "grey", group.line.width = 1.5, group.point.size = 6, group.colours = NULL, background.circle.colour = "#D7D6D1", background.circle.transparency = 0.2, plot.legend = if (nrow(plot.data) > 1) TRUE else FALSE, legend.title = "", plot.title = "", legend.text.size = 14, legend.position = "left" )
plot.data
: dataframe comprising one row per groupbase.size
: text sizefont.radar
: text font familyvalues.radar
: values to print at minimum, 'average', and maximum gridlinesaxis.labels
: names of axis labels if other than column names supplied via plot.datagrid.min
: value at which mininum grid line is plottedgrid.mid
: value at which 'average' grid line is plottedgrid.max
: value at which maximum grid line is plottedcentre.y
: value of y at centre of plotplot.extent.x.sf
: controls relative size of plot horizontallyplot.extent.y.sf
: controls relative size of plot verticallyx.centre.range
: controls axis label alignmentlabel.centre.y
: whether value of y at centre of plot should be labelledgrid.line.width
: width of gridlinegridline.min.linetype
: line type of minimum gridlinegridline.mid.linetype
: line type of 'average' gridlinegridline.max.linetype
: line type of maximum gridlinegridline.min.colour
: colour of minimum gridlinegridline.mid.colour
: colour of 'average' gridlinegridline.max.colour
: colour of maximum gridlinegrid.label.size
: text size of gridline labelgridline.label.offset
: displacement to left/right of central vertical axislabel.gridline.min
: whether or not to label the mininum gridlinelabel.gridline.mid
: whether or not to label the 'mininum'average' gridlinelabel.gridline.max
: whether or not to label the maximum gridlineaxis.label.offset
: vertical displacement of axis labels from maximum grid line, measured relative to circle diameteraxis.label.size
: text size of axis labelaxis.line.colour
: colour of axis linegroup.line.width
: line width of groupgroup.point.size
: point size of groupgroup.colours
: colour of groupbackground.circle.colour
: colour of background circle/radarbackground.circle.transparency
: transparency of background circle/radarplot.legend
: whether to include a plot legendlegend.title
: title of legendplot.title
: title of radar plotlegend.text.size
: text size in legendlegend.position
: position of legend, valid values are "top", "right", "bottom", "left"a ggplot object
library(dplyr) library(scales) library(tibble) mtcars_radar <- mtcars %>% as_tibble(rownames = "group") %>% mutate_at(vars(-group), rescale) %>% tail(4) %>% select(1:10) mtcars_radar ggradar(mtcars_radar)
Useful links
Downloads (last 30 days):