gg: Universal graphics functions

Description Usage Arguments Details Value Note Examples

View source: R/gg_graphics.R

Description

Default (ggplot2) visualisations for Momocs objects.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
gg0(x, ...)

## Default S3 method:
gg0(x, ...)

## S3 method for class 'coo_single'
gg0(x, ...)

## S3 method for class 'mom_tbl'
gg0(x, ...)

## S3 method for class 'tbl'
gg0(x, ...)

gg(x, first = TRUE, centroid = TRUE, axes = TRUE, ...)

Arguments

x

a Momocs object

...

additional parameters to feed geoms

first

logical whether to draw first point

centroid

logical whether to draw centroid

axes

logical whether to draw axes, text and grid

gg

ggplot object, default to ggplot2::last_plot

Details

gg is the base plotter. gg0 prepare the canvas but let you pick your ggplot2::geoms. draw add shapes on top of last plot

Value

a ggplot object

Note

I call it "universal" as a reminder to provide a gg for each object.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
b <- bot %>% pick(5)
gg(b)

# Let's add some geoms to
nice_plot <- gg0(b) +
    ggplot2::geom_polygon(color="grey50", fill="red", alpha=0.25) +
    ggplot2::geom_point(shape="circle plus")
nice_plot # print it

# you have all ggplot2 for free 8-)
# you do not have to ggplot2:: if you library(ggplot2) before
gorgeous_plot <- nice_plot + ggplot2::theme_minimal() +
    ggplot2::labs(x="abscissa", y="ordinate", title="Drink responsibly")

# this is a plotting factory !
# gorgeous_plot %+% pick(bot, 12)

MomX/Momocs2 documentation built on May 13, 2020, 4:28 a.m.