Description Usage Arguments Details Value Examples
Plots a personograph from a named list with percentages (must sum to 1). A personograph is a graphical represenation of relative benefit or harm, using a grid of icons with different colors. Its intended use is similar to that of Cates Plots (Visual Rx, Number Needed to Treat visualization). Although these could be seen as Kuiper-Marshall plots.
1 2 3 4 5 | personograph(data, fig.title = NULL, fig.cap = NULL, draw.legend = T,
icon = NULL, icon.dim = NULL, icon.style = 1, n.icons = 100,
plot.width = 0.75, dimensions = ceiling(sqrt(c(n.icons, n.icons))),
fudge = 0.0075, legend.show.zeros = TRUE, force.fill = "ignore",
round.fn = round.standard, colors = as.colors(data))
|
data |
A list of names to percentages (from 0 to 1) |
fig.title |
Figure title |
fig.cap |
Figure caption |
draw.legend |
Logical if TRUE (default) will draw the legend |
icon |
A |
icon.dim |
The dimensions of icon as a vector |
icon.style |
A numeric from 1-11 indicating which of the included icons to use, they are mostly variations on the theme |
n.icons |
Number of icons to draw, defaults to 100 |
plot.width |
The percentage of width that the main plotting area should take (with respect to the frame) |
dimensions |
A vector of |
fudge |
Fudge factor for the icon size, substracted from the |
legend.show.zeros |
Logical if TRUE indicating whether to show zero (0) values in the legend. |
force.fill |
A character vector of 'ignore' (default), 'most', 'least', or one of the names from |
round.fn |
Function that is applied to round the percentages from |
colors |
A vector of names to colors, must match the names in data. Uses |
You can supply your own icon by setting icon
to a grImport
Picture
.
A Picture
can be loaded with grImport::readPicture
which requires a grImport
XML file.
Obtaining this file from a standard SVG or PDF graphics file requires conversion.
The easiest way is to convert your original file to PDF and then to PostScript (PS) with the command-line pdf2ps
tool, then tracing it with grImport::PostScriptTrace
.
See the grImport
package documentation for more details.
None.
1 2 3 4 5 6 7 8 | data <- list(first=0.9, second=0.1)
personograph(data)
# With colors
personograph(data, colors=list(first="red", second="blue"))
# With different icon.style
personograph(data, icon.style=4) # numeric from 1-11
# Plot a thousand in a 20x50 grid
personograph(data, n.icons=1000, dimensions=c(20,50), plot.width=0.75)
|
Loading required package: grImport
Loading required package: grid
Loading required package: XML
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.