Descriptive Statistics Graphics and Utilities

Draws the statistical graphics of the 'DescToolsX' ecosystem on top of base graphics: distribution and density displays, bivariate and categorical plots, diagnostic and model evaluation panels, and a faceting mechanism for arranging them. A theme system resolves colours, symbols and layout centrally, so a consistent look can be set once rather than repeated at every call. The package also contains the colour conversion and palette tools, the geometry helpers, the number and string formatting routines and the HTML output utilities that the plots are built from. It is self contained and usable without the rest of the suite.


πŸ“¦ pharos pharos logo

CRAN status License: GPL v2 R-CMD-check

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

πŸ”Ή Univariate and Distribution Plots

  • plotFreqDist(), plotDens(), plotECDF(), plotProbDist()
  • plotBox(), plotViolin(), plotRidge(), plotDensBox()
  • plotDot(), plotBar(), plotBag(), plotQQ()
  • plotLines(), plotTimeSeries(), plotFun()

πŸ”Ή Bivariate and Multivariate Plots

  • plotXY(), plotBubble(), plotDens2D(), plotHexbin()
  • plotCor(), plotAssoc(), plotMosaic(), plotHeatmap()
  • plotTernary(), plotPolar(), plotCirc(), plotSankey(), plotWeb(), plotTreemap()

πŸ”Ή Model and Diagnostic Displays

  • plotLift(), plotPropCI(), plotMiss(), plotCatDist()
  • plot() methods for Bland-Altman and Lorenz curve objects, plotBinaryTree()
  • lines() methods for lm and loess fits

πŸ”Ή Layout and Faceting

  • plotFacet() β€” panel layouts with a user-supplied panel function
  • canvas(), plotArea(), mar(), abcCoords(), axisBreak(), axTicksPosixct(), axisFmt()
  • spreadOut(), lineToUser(), isValidPlotRegion()

πŸ”Ή Annotation

  • boxedText(), barText(), textLegend(), colLegend(), errBars(), band(), stamp(), titleRect(), lineSep()

πŸ”Ή Colour

  • Conversions: colToHex(), colToRgb(), colToHsv(), hexToRgb(), rgbToCmy(), cmykToRgb(), longToRgb()
  • Manipulation: addOpacity(), fade(), darken(), lighten(), shade(), mixCol(), contrastCol(), grayScale()
  • Palettes: pal(), palNames(), hcol(), findCol(), setBackCol()

πŸ”Ή Geometry

  • arc(), bezier(), circle(), ellipse(), ring(), polygonX(), regPolygon(), polarGrid()
  • rotate(), transformXY(), coordinate conversions, degree/radian conversion, convUnit()

πŸ”Ή Formatting and Strings

  • fm(), fmCI(), unit(), ftable() method for lists
  • strAbbr(), strAlign(), strCap(), strChop(), strPad(), strTrunc(), strRev(), strDist(), strSpell(), strExtract()

πŸ”Ή HTML Output

  • asHtml(), toHtmlTable(), escapeHtml(), htmlHat(), htmlBar(), %_%, asImg(), asFileLink(), embedFile(), preview()

πŸš€ Design Principles

  • Consistent β€” lowerCamelCase API and uniform argument conventions across the whole DescToolsX suite
  • Themed β€” colours, symbols and layout resolved centrally through getTheme(), setTheme() / resetTheme() and style()
  • 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
plotFreqDist(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: one panel per sample, drawn by a panel function
samples <- lapply(split(iris, iris$Species),
                  function(d) list(x = d$Sepal.Length, y = d$Petal.Length))

plotFacet(samples, dim = c(1, 3),
          FUN  = function(x, y, col, pch, ...) points(x, y, col = col, pch = pch),
          xlab = "Sepal length", ylab = "Petal length")

# flows between stages: one row per flow
plotSankey(data.frame(from  = c("A", "A", "B", "C", "D"),
                      to    = c("C", "D", "D", "E", "F"),
                      value = c(5, 3, 4, 5, 7)))

🧱 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.

πŸ™ Acknowledgements

Parts of the code and documentation were reviewed with the help of large language models (OpenAI Codex, Anthropic Claude). Every suggestion was assessed, edited and verified by the maintainer, who remains solely responsible for the content of this package.

πŸ“œ License

GPL (β‰₯ 2)

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("pharos")

0.1.6 by Andri Signorell, 11 hours ago


https://andrisignorell.github.io/pharos/, https://github.com/AndriSignorell/pharos/


Report a bug at https://github.com/AndriSignorell/pharos/issues


Browse source code at https://github.com/cran/pharos


Authors: Andri Signorell [aut, cre] (ORCID: , R Core Team [ctb] , Ben Bolker [ctb] , Jeff Enos [ctb] , Maxime Genest [ctb] (Fortran code of package 'depth') , Frank E. Harrell Jr [ctb] , Henk Harmsen [ctb] , Christian W. Hoffmann [ctb] , Markus Huerzeler [ctb] , Matthias Kohl [ctb] , Jim Lemon [ctb] , Arni Magnusson [ctb] , Jean-Claude MassΓ© [ctb] (Fortran code of package 'depth') , Markus Naepflin [ctb] , Jean-FranΓ§ois Plante [ctb] (Fortran code of package 'depth') , B. D. Ripley [ctb] , Peter J. Rousseeuw [ctb, cph] (Algorithm AS 307 (halfspace depth)) , Ida Ruts [ctb, cph] (Algorithm AS 307 (halfspace depth)) , Terry Therneau [ctb] , John Verzani [ctb] , W. N. Venables [ctb] , Hans Peter Wolf [ctb] , Ying Wu [ctb]


Documentation:   PDF Manual  


GPL (>= 2) license


Imports Rcpp, bedrock, MASS, cli, withr, stringi, methods, base64enc, grid

Suggests testthat, R.rsp, hexbin, prettyunits, pdftools

Linking to Rcpp


See at CRAN