SCM

SCM Repository

[directlabels] Annotation of /tex/useR-2011/directlabels.Rnw
ViewVC logotype

Annotation of /tex/useR-2011/directlabels.Rnw

Parent Directory Parent Directory | Revision Log Revision Log


Revision 414 - (view) (download)

1 : tdhock 413 \documentclass[11pt,a4paper]{article}
2 :     \usepackage{amsfonts, amsmath, hanging, hyperref, natbib, parskip, times}
3 :     \usepackage[pdftex]{graphicx}
4 :     \hypersetup{
5 :     colorlinks,
6 :     linkcolor=blue,
7 :     urlcolor=blue
8 :     }
9 : tdhock 200
10 : tdhock 413 \let\section=\subsubsection
11 :     \newcommand{\pkg}[1]{{\normalfont\fontseries{b}\selectfont #1}}
12 :     \let\proglang=\textit
13 :     \let\code=\texttt
14 :     \renewcommand{\title}[1]{\begin{center}{\bf \LARGE #1}\end{center}}
15 :     \newcommand{\affiliations}{\footnotesize}
16 :     \newcommand{\keywords}{\paragraph{Keywords:}}
17 : tdhock 200
18 : tdhock 413 \setlength{\topmargin}{-15mm}
19 :     \setlength{\oddsidemargin}{-2mm}
20 :     \setlength{\textwidth}{165mm}
21 :     \setlength{\textheight}{250mm}
22 : tdhock 200
23 :     \begin{document}
24 : tdhock 413 \pagestyle{empty}
25 : tdhock 200
26 : tdhock 413 \title{Adding direct labels to plots}
27 : tdhock 200
28 : tdhock 413 \begin{center}
29 : tdhock 414 {\bf Toby Dylan Hocking$^{1,2,^\star}$}
30 : tdhock 413 \end{center}
31 :    
32 :     \begin{affiliations}
33 : tdhock 414 1. INRIA Sierra team for machine learning research,
34 :     23 avenue d'Italie, Paris, France\\[-2pt]
35 :     2. Institut Curie/INSERM U900/Mines ParisTech cancer bioinformatics group,
36 :     26 rue d'Ulm, Paris, France\\[-2pt]
37 :     $^\star$Contact author:
38 :     \href{mailto:toby.hocking@inria.fr}{toby.hocking@inria.fr}
39 : tdhock 413 \end{affiliations}
40 :    
41 :     \keywords Visualization, graphics, legends, direct labels
42 :    
43 :     \vskip 0.8cm
44 :    
45 :     High-level plotting systems such as \pkg{lattice} and \pkg{ggplot2}
46 :     provide automatic legends for decoding color labels in \proglang{R}
47 :     plots \citep{lattice,ggplot2}. However, with many colors, legends
48 :     become difficult to read, and direct labels are a more suitable
49 :     decoding method:
50 :    
51 : tdhock 411 <<echo=FALSE>>=
52 : tdhock 413 options(width=70)
53 : tdhock 411 @
54 : tdhock 200
55 : tdhock 411 <<fig=TRUE,height=4,width=8,center=TRUE>>=
56 :     library(lattice)
57 :     data(mpg,package="ggplot2")
58 : tdhock 413 p <- xyplot(jitter(cty)~jitter(hwy),mpg,groups=class,
59 :     main="City and highway fuel efficiency depends on car class")
60 :     ##p2 <- update(p,main="City and highway fuel efficiency depends on car class")
61 : tdhock 411 library(directlabels)
62 : tdhock 413 print(direct.label(p))
63 : tdhock 411 @
64 :    
65 : tdhock 216 Direct labels are inherently more intuitive to decode than legends,
66 :     since they are placed near the related data. However, direct labels
67 :     are not widely used because they are often much more difficult to
68 :     implement than legends, and their implementation varies between
69 :     plotting systems.
70 : tdhock 200
71 : tdhock 413 The \pkg{directlabels} package solves these problems by providing a
72 :     simple, unified interface for direct labeling in \proglang{R}. Given a
73 :     \pkg{lattice} or \pkg{ggplot2} plot saved in the variable \texttt{p},
74 :     direct labels can be added by calling \texttt{direct.label(p,f)} where
75 :     \texttt{f} is a Positioning Method that describes where labels
76 :     should be placed as a function of the data. The power of this system
77 :     lies in the fact that you can write your own Positioning Methods,
78 :     and that any Positioning Method can be used with any plot. So once
79 :     you have a library of Positioning Methods, direct labeling becomes
80 :     trivial and so can more easily used as a visualization technique in
81 :     everyday statistical practice.
82 : tdhock 216
83 : tdhock 411 % The
84 : tdhock 413 % \pkg{directlabels} package comes with several Positioning Methods for
85 : tdhock 411 % different plot types, and a system of intelligent defaults so that
86 : tdhock 413 % often you don't even need to specify the Positioning Method.
87 : tdhock 216
88 : tdhock 413 \bibliographystyle{chicago}
89 : tdhock 411 \bibliography{refs}
90 : tdhock 216
91 : tdhock 200 \end{document}

root@r-forge.r-project.org
ViewVC Help
Powered by ViewVC 1.0.0  
Thanks to:
Vienna University of Economics and Business Powered By FusionForge