This document demonstrates the features of unifying plots in pander. First, if you do not want to deal with styling each of your images, just activate it: evalsOptions('graph.unify', TRUE).

Note: please install lattice and ggplot2 on your computer prior to trying to run all examples of this document.

Options

There are a bunch of options you might want to check out, these are:

• graph.nomargin
• graph.fontfamily
• graph.fontcolor
• graph.fontsize
• graph.grid
• graph.grid.minor
• graph.grid.color
• graph.grid.lty
• graph.boxes
• graph.legend.position
• graph.background
• graph.panel.background
• graph.colors
• graph.color.rnd
• graph.axis.angle
• graph.symbol

Find more details on pander's homepage.

Default options

Not touching the above ones, let us check out how different plots look like by calling base R graphing function, lattice or ggplot2!

WARNING1

WARNING2

WARNING3

Grouped plot

Base R plot

I have no idea how to do that besides manually adding points.

Facets

Base R plot

I have no idea how to do that besides par(mfrow=c(foo, bar)).

WARNING4

ERROR5

Custom options

Below you can find some images generated by the exact same commands but with some modified panderOptions:

panderOptions('graph.fontfamily', "Comic Sans MS")
panderOptions('graph.fontsize', 18)
panderOptions('graph.fontcolor', 'blue')
panderOptions('graph.grid.color', 'blue')
panderOptions('graph.axis.angle', 3)
panderOptions('graph.boxes', T)
panderOptions('graph.legend.position', 'top')
panderOptions('graph.colors', rainbow(5))
panderOptions('graph.grid', FALSE)
panderOptions('graph.symbol', 22)

Barplot

Base R plot

Yeah, the "Foo bar" label is cropped. We need a custom mar option here:

But wait, we lost the color! Right: unfortunately coloring base R plots is really hackish, pander is adding the col attribute to the calls. If you start to tweak par in a chunk, you should prepare to some unwanted side-effects. Solution:

ERROR6

Grouped plot

Base R plot

I have no idea how to do that besides manually adding points.

Facets

Base R plot

I have no idea how to do that besides par(mfrow=c(foo, bar)).

Lines

ERROR7

ggplot2

1. Applying default formatting to image is somehow compromised (the result could differ from what you specified in panderOptions). Hints: printing lattice/ggplot2 is not needed and tweaking base plots with par might have some side-effects!

2. Applying default formatting to image is somehow compromised (the result could differ from what you specified in panderOptions). Hints: printing lattice/ggplot2 is not needed and tweaking base plots with par might have some side-effects!

3. Applying default formatting to image is somehow compromised (the result could differ from what you specified in panderOptions). Hints: printing lattice/ggplot2 is not needed and tweaking base plots with par might have some side-effects!

4. Applying default formatting to image is somehow compromised (the result could differ from what you specified in panderOptions). Hints: printing lattice/ggplot2 is not needed and tweaking base plots with par might have some side-effects!

5. :1:1: unexpected '/' 1: / ^

6. :1:1: unexpected '/' 1: / ^

7. :1:1: unexpected '/' 1: / ^

Design: Rapporter Team © 2011-2014 | Backend: pander | License: AGPL3 or OSL | Styled with skeleton