\documentclass[10pt,a4paper]{article} % Packages \usepackage{fancyhdr} % For header and footer \usepackage{multicol} % Allows multicols in tables \usepackage{tabularx} % Intelligent column widths \usepackage{tabulary} % Used in header and footer \usepackage{hhline} % Border under tables \usepackage{graphicx} % For images \usepackage{xcolor} % For hex colours %\usepackage[utf8x]{inputenc} % For unicode character support \usepackage[T1]{fontenc} % Without this we get weird character replacements \usepackage{colortbl} % For coloured tables \usepackage{setspace} % For line height \usepackage{lastpage} % Needed for total page number \usepackage{seqsplit} % Splits long words. %\usepackage{opensans} % Can't make this work so far. Shame. Would be lovely. \usepackage[normalem]{ulem} % For underlining links % Most of the following are not required for the majority % of cheat sheets but are needed for some symbol support. \usepackage{amsmath} % Symbols \usepackage{MnSymbol} % Symbols \usepackage{wasysym} % Symbols %\usepackage[english,german,french,spanish,italian]{babel} % Languages % Document Info \author{xeonkai} \pdfinfo{ /Title (r-graphical.pdf) /Creator (Cheatography) /Author (xeonkai) /Subject (R graphical Cheat Sheet) } % Lengths and widths \addtolength{\textwidth}{6cm} \addtolength{\textheight}{-1cm} \addtolength{\hoffset}{-3cm} \addtolength{\voffset}{-2cm} \setlength{\tabcolsep}{0.2cm} % Space between columns \setlength{\headsep}{-12pt} % Reduce space between header and content \setlength{\headheight}{85pt} % If less, LaTeX automatically increases it \renewcommand{\footrulewidth}{0pt} % Remove footer line \renewcommand{\headrulewidth}{0pt} % Remove header line \renewcommand{\seqinsert}{\ifmmode\allowbreak\else\-\fi} % Hyphens in seqsplit % This two commands together give roughly % the right line height in the tables \renewcommand{\arraystretch}{1.3} \onehalfspacing % Commands \newcommand{\SetRowColor}[1]{\noalign{\gdef\RowColorName{#1}}\rowcolor{\RowColorName}} % Shortcut for row colour \newcommand{\mymulticolumn}[3]{\multicolumn{#1}{>{\columncolor{\RowColorName}}#2}{#3}} % For coloured multi-cols \newcolumntype{x}[1]{>{\raggedright}p{#1}} % New column types for ragged-right paragraph columns \newcommand{\tn}{\tabularnewline} % Required as custom column type in use % Font and Colours \definecolor{HeadBackground}{HTML}{333333} \definecolor{FootBackground}{HTML}{666666} \definecolor{TextColor}{HTML}{333333} \definecolor{DarkBackground}{HTML}{00D5F7} \definecolor{LightBackground}{HTML}{EFFCFE} \renewcommand{\familydefault}{\sfdefault} \color{TextColor} % Header and Footer \pagestyle{fancy} \fancyhead{} % Set header to blank \fancyfoot{} % Set footer to blank \fancyhead[L]{ \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{C} \SetRowColor{DarkBackground} \vspace{-7pt} {\parbox{\dimexpr\textwidth-2\fboxsep\relax}{\noindent \hspace*{-6pt}\includegraphics[width=5.8cm]{/web/www.cheatography.com/public/images/cheatography_logo.pdf}} } \end{tabulary} \columnbreak \begin{tabulary}{11cm}{L} \vspace{-2pt}\large{\bf{\textcolor{DarkBackground}{\textrm{R graphical Cheat Sheet}}}} \\ \normalsize{by \textcolor{DarkBackground}{xeonkai} via \textcolor{DarkBackground}{\uline{cheatography.com/31513/cs/9603/}}} \end{tabulary} \end{multicols}} \fancyfoot[L]{ \footnotesize \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{LL} \SetRowColor{FootBackground} \mymulticolumn{2}{p{5.377cm}}{\bf\textcolor{white}{Cheatographer}} \\ \vspace{-2pt}xeonkai \\ \uline{cheatography.com/xeonkai} \\ \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Cheat Sheet}} \\ \vspace{-2pt}Not Yet Published.\\ Updated 5th November, 2016.\\ Page {\thepage} of \pageref{LastPage}. \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Sponsor}} \\ \SetRowColor{white} \vspace{-5pt} %\includegraphics[width=48px,height=48px]{dave.jpeg} Measure your website readability!\\ www.readability-score.com \end{tabulary} \end{multicols}} \begin{document} \raggedright \raggedcolumns % Set font size to small. Switch to any value % from this page to resize cheat sheet text: % www.emerson.emory.edu/services/latex/latex_169.html \footnotesize % Small font. \begin{multicols*}{3} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Basic code}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{pdf("mygraph.pdf") \newline attach(mtcars) \newline plot(wt, mpg) \newline abline(lm(mpg \textasciitilde{} wt)) \newline title("Regression of MPG on Weight") \newline detach(mtcars) \newline \newline x \textless{}- c(1:10) \newline y \textless{}- x \newline lines(x, y, type="b", pch=22, col="blue", lty=2) \newline dev.off()} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Variations include win.metafile(), png(), jpeg(), bmp(), tiff(), xfig(), postscript() \newline Other functions include dev.new(), dev.next(), dev.prev(), dev.set()} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Basic graph}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{p{5.377cm}}{\vspace{1px}\centerline{\includegraphics[width=5.1cm]{/web/www.cheatography.com/public/uploads/xeonkai_1478316197_mygraph.jpeg}}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Graphical parameters}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{`par(optionname=value, optionname=value, ...)` \newline % Row Count 1 (+ 1) `opar \textless{}- par(no.readonly=TRUE)` \newline % Row Count 2 (+ 1) `par(lty=2, pch=17)` \newline % Row Count 3 (+ 1) `plot(dose, drugA, type="b")` \newline % Row Count 4 (+ 1) `\# type - "b": both points and lines, "l": lines, "p": points, "c": lines part of "b", "n": no plotting, "o": both "overplotted"` \newline % Row Count 7 (+ 3) `par(opar)`% Row Count 8 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{p{0.54747 cm} x{4.42953 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Symbols and lines}} \tn % Row 0 \SetRowColor{LightBackground} `pch` & Specifies the symbol to use when plotting points \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} `cex` & Specifies the symbol size. A number indicating the amount plotting symbols are scaled relative to default. 1=default, 1.5 is 50\% larger, 0.5 is 50\% smaller, and so forth. \tn % Row Count 7 (+ 5) % Row 2 \SetRowColor{LightBackground} `lty` & Specifies the line type \tn % Row Count 9 (+ 2) % Row 3 \SetRowColor{white} `lwd` & Specifies the line width. Expressed relative to default (=1), e.g. `lwd=2` - a line twice as wide as the default \tn % Row Count 13 (+ 4) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Plot symbols}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{p{5.377cm}}{\vspace{1px}\centerline{\includegraphics[width=5.1cm]{/web/www.cheatography.com/public/uploads/xeonkai_1477382997_fig2.JPG}}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Line types}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{p{5.377cm}}{\vspace{1px}\centerline{\includegraphics[width=5.1cm]{/web/www.cheatography.com/public/uploads/xeonkai_1477383027_fig3.JPG}}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.34379 cm} x{3.63321 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Color parameters}} \tn % Row 0 \SetRowColor{LightBackground} `col` & Default plotting color. Some functions (e.g. lines and pie) accept a vector of values that are recycled. \tn % Row Count 4 (+ 4) % Row 1 \SetRowColor{white} \seqsplit{`col.axis`} & Color for axis text \tn % Row Count 5 (+ 1) % Row 2 \SetRowColor{LightBackground} `col.lab` & Color for axis labels \tn % Row Count 6 (+ 1) % Row 3 \SetRowColor{white} \seqsplit{`col.main`} & Color for titles \tn % Row Count 7 (+ 1) % Row 4 \SetRowColor{LightBackground} `col.sub` & Color for subtitles \tn % Row Count 8 (+ 1) % Row 5 \SetRowColor{white} `fg` & The plot's foreground color \tn % Row Count 9 (+ 1) % Row 6 \SetRowColor{LightBackground} `bg` & The plot's background color \tn % Row Count 10 (+ 1) % Row 7 \SetRowColor{white} \seqsplit{`rainbow(\#)`} & Produces \# contiguous "rainbow" colors \tn % Row Count 12 (+ 2) % Row 8 \SetRowColor{LightBackground} \seqsplit{`gray(0:10/10)`} & Specify gray levels as a vector of numbers between 0 and 1. This produces 10 gray levels. \tn % Row Count 16 (+ 4) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{0.9954 cm} x{3.9816 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Text parameters}} \tn % Row 0 \SetRowColor{LightBackground} `cex` & Number indicating the amount by which plotted text should be scaled relative to the default \tn % Row Count 3 (+ 3) % Row 1 \SetRowColor{white} \seqsplit{`cex.axis`} & Magnification of axis text relative to `cex` \tn % Row Count 5 (+ 2) % Row 2 \SetRowColor{LightBackground} \seqsplit{`cex.lab`} & Magnification of axis labels relative to `cex` \tn % Row Count 7 (+ 2) % Row 3 \SetRowColor{white} \seqsplit{`cex.main`} & Magnification of titles relative to `cex` \tn % Row Count 9 (+ 2) % Row 4 \SetRowColor{LightBackground} \seqsplit{`cex.sub`} & Magnification of subtitles relative to `cex` \tn % Row Count 11 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.09494 cm} x{3.88206 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Font parameters}} \tn % Row 0 \SetRowColor{LightBackground} `font` & Integer specifying font to use for plotted text. 1=plain, 2=bold, 3 =italic, 4=bold italic, 5=symbol (Adobe symbol encoding) \tn % Row Count 4 (+ 4) % Row 1 \SetRowColor{white} \seqsplit{`font.axis`} & Font for axis text \tn % Row Count 6 (+ 2) % Row 2 \SetRowColor{LightBackground} \seqsplit{`font.lab`} & Font for axis labels \tn % Row Count 8 (+ 2) % Row 3 \SetRowColor{white} \seqsplit{`font.main`} & Font for titles \tn % Row Count 10 (+ 2) % Row 4 \SetRowColor{LightBackground} \seqsplit{`font.sub`} & Font for subtitles \tn % Row Count 12 (+ 2) % Row 5 \SetRowColor{white} `ps` & Font point size (roughly 1/72 inch). The text size = ps*cex. \tn % Row Count 14 (+ 2) % Row 6 \SetRowColor{LightBackground} \seqsplit{`family`} & Font family for drawing text. Standard values are `serif`, `sans`, and `mono`. \tn % Row Count 17 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{Mapping for font family created via windowsFont() function. \newline For Mac, use quartzFonts(). \newline \newline `windowsFonts(` \newline `A=windowsFont("Arial Black"),` \newline `B=windowsFont("Bookman Old Style"),` \newline `C=windowsFont("Comic Sans MS")` \newline `)`} \tn \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{p{0.54747 cm} x{4.42953 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Graph and margin parameters}} \tn % Row 0 \SetRowColor{LightBackground} `pin` & Plot dimensions (width, height) in inches \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} `mai` & Numerical vector indicating margin size, c(bottom,left,top,right). Expressed in inches \tn % Row Count 5 (+ 3) % Row 2 \SetRowColor{LightBackground} `mar` & Numerical vector indicating margin size, c(bottom,left,top,right). Expressed in lines. The default is c(5,4,4,2) + 0.1. \tn % Row Count 9 (+ 4) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Example code}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{dose \textless{}- c(20,30,40,45,60) \newline drugA \textless{}- c(16,20,27,40,60) \newline drugB \textless{}- c(15,18,25,31,40) \newline opar \textless{}- par(no.readonly=TRUE) \newline par(pin=c(2,3)) \newline par(lwd=2, cex=1.5) \newline par(cex.axis=.75, font.axis=3) \newline plot(dose, drugA, type="b", pch=19, lty=2, col="red") \newline lines(dose, drugB, type="b", pch=23, lty=6, col="blue", bg="green") \newline par(opar)} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Resulting graph}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{p{5.377cm}}{\vspace{1px}\centerline{\includegraphics[width=5.1cm]{/web/www.cheatography.com/public/uploads/xeonkai_1478316531_Rplot.png}}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{2.43873 cm} x{2.53827 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Graph text and customization}} \tn % Row 0 \SetRowColor{LightBackground} `ann=FALSE` & Using in plot() statement or par() statement remove default titles and labels \tn % Row Count 4 (+ 4) % Row 1 \SetRowColor{white} `title()` & `title(main="main title", col.main="red", sub="sub-title", col.sub="blue", xlab="x-axis label", ylab="y-axis label", col.lab="green", cex.lab=0.75)` \tn % Row Count 12 (+ 8) % Row 2 \SetRowColor{LightBackground} `axis()` & Create custom axes. When creating a custom axis, suppress axis by using option `axes=FALSE` (suppresses all axes, including axis frame lines, unless `frame.plot=TRUE`), `xaxt="n"` or `yaxt="n"`. See Axis options. \tn % Row Count 23 (+ 11) % Row 3 \SetRowColor{white} `text()` & Add text within graph, typically labeling points or text annotations, e.g. `text(location, "text", pos, ...)` \tn % Row Count 29 (+ 6) % Row 4 \SetRowColor{LightBackground} `mtext()` & Add text to margin of plot \tn % Row Count 31 (+ 2) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{5.377cm}{x{2.43873 cm} x{2.53827 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Graph text and customization (cont)}} \tn % Row 5 \SetRowColor{LightBackground} & e.g. `mtext("text", side=4, line=3, cex.lab=1, las=2, col="blue")` \tn % Row Count 4 (+ 4) % Row 6 \SetRowColor{white} `plotmath()` & Add mathematical symbols and formulas to graph \tn % Row Count 7 (+ 3) % Row 7 \SetRowColor{LightBackground} `abline()` & Add reference lines to graph e.g. `abline(h=yvalues, v=xvalues)` \tn % Row Count 11 (+ 4) % Row 8 \SetRowColor{white} & `abline(h=c(1,5,7)` adds horizontal lines at y=1, 5 \& 7 \tn % Row Count 14 (+ 3) % Row 9 \SetRowColor{LightBackground} `legend(location, title, legend, ...)` & location - (x,y) coordinate, locator(1), keywords, i.e. `bottom, bottomleft, left, topleft, top, topright, right, bottomright, center`. Use `inset=` to specify amount to move legend into graph as fraction of plot region. \tn % Row Count 25 (+ 11) % Row 10 \SetRowColor{white} & title - character string for the legend title (optional) \tn % Row Count 28 (+ 3) % Row 11 \SetRowColor{LightBackground} & legend - character vector with the labels \tn % Row Count 31 (+ 3) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{5.377cm}{x{2.43873 cm} x{2.53827 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Graph text and customization (cont)}} \tn % Row 12 \SetRowColor{LightBackground} & ... - Other options: `col=`, `pch=`, `lwd=`, `lty=`, `fill=`, `bty=`, `bg=`, `cex=`, `text.col=`, `horiz=TRUE` \tn % Row Count 6 (+ 6) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Example code}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{attach(mtcars) \newline plot(wt, mpg, main="Mileage vs. Car Weight", xlab="Weight", ylab="Mileage", pch=18, col="blue") \newline text(wt, mpg, row.names(mtcars), cex=0.6, pos=4, col="red") \newline detach(mtcars)} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Resulting graph}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{p{5.377cm}}{\vspace{1px}\centerline{\includegraphics[width=5.1cm]{/web/www.cheatography.com/public/uploads/xeonkai_1478317106_Rplot02.png}}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Combining graphs}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{{\bf{Used in `par()` or `layout()` function:}} \newline % Row Count 1 (+ 1) `mfrow=c(nrows, ncols)` - fill by row \newline % Row Count 2 (+ 1) `mfcol=c(nrows, ncols)` - fill by column \newline % Row Count 3 (+ 1) {\bf{`layout(mat)`}} \newline % Row Count 4 (+ 1) where `mat` is matrix object specifying location of multiple plots to combine \newline % Row Count 6 (+ 2) e.g. `layout(matrix(c(1,1,2,3), 2, 2, byrow = TRUE))` \newline % Row Count 8 (+ 2) - one figure placed in row 1 and two figures placed in row 2 \newline % Row Count 10 (+ 2) Optional parameters for `layout()`: \newline % Row Count 11 (+ 1) `widths()` - a vector of values for widths of columns \newline % Row Count 13 (+ 2) `heights()` - a vector of values for heights of rows \newline % Row Count 15 (+ 2) e.g. `layout(matrix(c(1, 1, 2, 3), 2, 2, byrow = TRUE), widths=c(3, 1), heights=c(1, 2))` \newline % Row Count 17 (+ 2) {\bf{Used in `par()` function:}} \newline % Row Count 18 (+ 1) `fig=c(x1, x2, y1, y2), new = TRUE` - Plot within limits of (x1,x2) and (y1,y2), `new = TRUE` option adds figure to existing graph% Row Count 21 (+ 3) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{0.84609 cm} x{4.13091 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Axis options}} \tn % Row 0 \SetRowColor{LightBackground} \seqsplit{`side`} & An integer indicating the side of the graph to draw the axis (1=bottom, 2=left, 3=top, 4=right) \tn % Row Count 3 (+ 3) % Row 1 \SetRowColor{white} `at` & A numeric vector indicating where tick marks should be drawn \tn % Row Count 5 (+ 2) % Row 2 \SetRowColor{LightBackground} \seqsplit{`labels`} & A character vector of labels to be placed at the tick marks (if `NULL`, the `at` values will be used) \tn % Row Count 9 (+ 4) % Row 3 \SetRowColor{white} `pos` & The coordinate at which the axis line is to be drawn (i.e. the value on the other axis where it crosses) \tn % Row Count 13 (+ 4) % Row 4 \SetRowColor{LightBackground} `lty` & Line type \tn % Row Count 14 (+ 1) % Row 5 \SetRowColor{white} `col` & The line and tick mark color \tn % Row Count 15 (+ 1) % Row 6 \SetRowColor{LightBackground} `las` & Labels are parallel (=0) or perpendicular (=2) to the axis \tn % Row Count 17 (+ 2) % Row 7 \SetRowColor{white} `tck` & Length of tick mark as a fraction of the plotting region (a '-' number is outside the graph, a '+' number is inside, 0 suppresses ticks, 1 creates gridlines). Default is -0.01. \tn % Row Count 23 (+ 6) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{Adding minor tick marks require Hmisc package. \newline `library(Hmisc)` \newline `minor.tick(nx=n, ny=n, tick.ratio=n)` \newline where nx, ny are no. of intervals to divide major tick marks on x- and y-axis, tick.ratio is size of minor relative to major tick mark} \tn \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{demo(plotmath)}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{p{5.377cm}}{\vspace{1px}\centerline{\includegraphics[width=5.1cm]{/web/www.cheatography.com/public/uploads/xeonkai_1477647848_fig.JPG}}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} % That's all folks \end{multicols*} \end{document}