Movatterモバイル変換


[0]ホーム

URL:


Skip to contents

Add data points

Source:R/add-points.R
add_data_points.Rd

Add data points

Usage

add_data_points(plot,  data=all_rows(),  shape=19,  size=1,  white_border=FALSE,  dodge_width=NULL,  preserve="total",  rasterize=FALSE,  rasterize_dpi=300,...)add_data_points_jitter(plot,  data=all_rows(),  shape=19,  size=1,  white_border=FALSE,  dodge_width=NULL,  jitter_width=0.2,  jitter_height=0,  preserve="total",  rasterize=FALSE,  rasterize_dpi=300,...)add_data_points_beeswarm(plot,  data=all_rows(),  shape=19,  size=1,  white_border=FALSE,  cex=3,  corral="wrap",  corral.width=0.5,  dodge_width=NULL,  preserve="total",  rasterize=FALSE,  rasterize_dpi=300,...)

Arguments

plot

Atidyplot generated with the functiontidyplot().

data

The data to be displayed in this layer. There are three options:

  • Ifall_rows() (the default) the complete dataset is displayed.

  • Afunction to subset the plot data. Seefilter_rows() and friends.

  • Adata.frame to override the plot data.

shape

Aninteger between0 and24, representing the shape of theplot symbol.

size

Anumber representing the size of the plot symbol. Typicalvalues range between1 and3.

white_border

Whether to include a white border around data points. Defaults toFALSE.

dodge_width

For adjusting the distance between grouped objects. Defaultsto0.8 for plots with at least one discrete axis and0 for plots with twocontinuous axes.

preserve

Should dodging preserve the"total" width of all elements ata position, or the width of a"single" element?

rasterize

IfFALSE (the default) the layer will be constructed ofvector shapes. IfTRUE the layer will be rasterized to a pixel image. This canbe useful when plotting many individual objects (1,000 or more) compromisesthe performance of the generated PDF file.

rasterize_dpi

The resolution in dots per inch (dpi) used for rasteringthe layer ifrasterize isTRUE. The default is300 dpi.

...

Arguments passed on to thegeom function.

jitter_width

Amount of random noise to be added to thehorizontal position of the of the data points. This can be useful to dealwith overplotting. Typical values range between0 and1.

jitter_height

Amount of random noise to be added to thevertical position of the of the data points. This can be useful to dealwith overplotting. Typical values range between0 and1.

cex

Scaling for adjusting point spacing (seebeeswarm::swarmx()).Values between 1 (default) and 3 tend to work best.

corral

Method used to adjust points that would be placed too widehorizontally. Options are"none" (default),"gutter","wrap","random", and"omit".See Details below.

corral.width

Width of the corral, if not"none". Default is0.9.

Value

Atidyplot object.

Details

Examples

study|>tidyplot(x=treatment, y=score, color=treatment)|>add_data_points()study|>tidyplot(x=treatment, y=score, color=treatment)|>add_data_points_jitter()study|>tidyplot(x=treatment, y=score, color=treatment)|>add_data_points_beeswarm()# Changing argumentsstudy|>tidyplot(x=treatment, y=score, color=treatment)|>add_data_points_jitter(jitter_width=1)animals|>tidyplot(x=weight, y=size)|>add_data_points(white_border=TRUE)animals|>tidyplot(x=weight, y=size)|>add_data_points(alpha=0.4)# Rasterizationanimals|>tidyplot(x=weight, y=size)|>add_data_points(rasterize=TRUE, rasterize_dpi=50)# Data subsettinganimals|>tidyplot(x=weight, y=size)|>add_data_points()|>add_data_points(data=filter_rows(size>300), color="red")

[8]ページ先頭

©2009-2025 Movatter.jp