Title: Descriptive Statistics Graphics and Utilities
License: GPL (โฅ 2)
๐งฉ Overview
pharos is the graphics layer of the DescToolsX ecosystem. It draws statistical graphics on top of base graphics โ distribution and density displays, bivariate and categorical plots, diagnostic and model evaluation panels โ and supplies the colour, geometry, formatting and HTML tools they are built from.
A theme system resolves colours, symbols and layout centrally, so the look of a whole analysis can be set once instead of being repeated at every call.
The package is self-contained and usable without the rest of the suite.
๐ Documentation: https://andrisignorell.github.io/pharos/
โ๏ธ Installation
install.packages("pharos")Or the development version from GitHub:
remotes::install_github("AndriSignorell/pharos")๐ Core Features
๐น Layout and Faceting
-
plotFacet()โ panel layouts with a user-supplied panel function -
canvas(),plotArea(),mar(),abcCoords(),axisBreak(),axTicks(),axisFmt() -
spreadOut(),lineToUser(),isValidPlotRegion()
๐น Colour
- Conversions:
colToHex(),colToRGB(),colToHSV(),hexToRGB(),rgbToCmy(),cmykToRgb(),longToRGB() - Manipulation:
addOpacity(),fade(),darken(),lighten(),shade(),mixColors(),contrastColor(),grayScale() - Palettes:
pal(),palNames(),hcol(),findColor(),setBackCol()
๐น Geometry
-
arc(),bezier(),circle(),ellipse(),ring(),polygon(),regPolygon(),polarGrid() -
rotate(),transformXY(), coordinate conversions, degree/radian conversion,convUnit()
๐ Design Principles
- Consistent โ lowerCamelCase API and uniform argument conventions across the whole DescToolsX suite
-
Themed โ colours, symbols and layout resolved centrally through
theme()andstyle() - Base graphics โ no grid, no extra graphics stack; plots compose with everything already in R
- Fast โ performance-critical routines implemented in Rcpp
๐งช Example
library(pharos)
# distribution overview: histogram, density, boxplot, ecdf in one panel
plotFdist(rnorm(500))
# named plot positions without arithmetic
plot(rnorm(20), type = "n")
xy <- abcCoords("topleft", inset = 1)
text(xy$xy$x, xy$xy$y, "annotation", adj = xy$adj)
# colour manipulation
fade(pal("dark"), 0.4)
# faceting with a panel function
plotFacet(split(iris$Sepal.Length, iris$Species),
dim = c(1, 3), panelFun = plotDens)๐งฑ The Suite
pharos builds on bedrock (base utilities). DescToolsX (descriptive statistics), lumen (tests and intervals), alloy (modelling), pons (MS-Office) and swissValet (RStudio addins) complete the family.
