labeling

Axis labeling algorithms for R, used in ggplot
Log | Files | Refs | README

labeling-Ex.R (1268B)


      1 pkgname <- "labeling"
      2 source(file.path(R.home("share"), "R", "examples-header.R"))
      3 options(warn = 1)
      4 library('labeling')
      5 
      6 base::assign(".oldSearch", base::search(), pos = 'CheckExEnv')
      7 base::assign(".old_wd", base::getwd(), pos = 'CheckExEnv')
      8 cleanEx()
      9 nameEx("labeling-package")
     10 ### * labeling-package
     11 
     12 flush(stderr()); flush(stdout())
     13 
     14 ### Name: labeling-package
     15 ### Title: Axis labeling
     16 ### Aliases: labeling labeling-package
     17 ### Keywords: dplot
     18 
     19 ### ** Examples
     20 
     21 heckbert(8.1, 14.1, 4)	# 5 10 15
     22 wilkinson(8.1, 14.1, 4)	# 8 9 10 11 12 13 14 15
     23 extended(8.1, 14.1, 4)	# 8 10 12 14
     24 # When plotting, extend the plot range to include the labeling
     25 # Should probably have a helper function to make this easier
     26 data(iris)
     27 x <- iris$Sepal.Width
     28 y <- iris$Sepal.Length
     29 xl <- extended(min(x), max(x), 6)
     30 yl <- extended(min(y), max(y), 6)
     31 plot(x, y,
     32     xlim=c(min(x,xl),max(x,xl)),
     33     ylim=c(min(y,yl),max(y,yl)),
     34     axes=FALSE, main="Extended labeling")
     35 axis(1, at=xl)
     36 axis(2, at=yl)
     37 
     38 
     39 
     40 ### * <FOOTER>
     41 ###
     42 cleanEx()
     43 options(digits = 7L)
     44 base::cat("Time elapsed: ", proc.time() - base::get("ptime", pos = 'CheckExEnv'),"\n")
     45 grDevices::dev.off()
     46 ###
     47 ### Local variables: ***
     48 ### mode: outline-minor ***
     49 ### outline-regexp: "\\(> \\)?### [*]+" ***
     50 ### End: ***
     51 quit('no')