pmx_plot_individual: Individual plot

Description Usage Arguments Value Examples

View source: R/pmx-plots-individual.R

Description

Individual plot

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
pmx_plot_individual(
  ctr,
  which_pages = 1L,
  print = FALSE,
  dname,
  pred_line,
  ipred_line,
  point,
  is.legend,
  use.finegrid,
  bloq,
  filter,
  strat.facet,
  facets,
  strat.color,
  trans,
  pmxgpar,
  labels,
  axis.title,
  axis.text,
  ranges,
  is.smooth,
  smooth,
  is.band,
  band,
  is.draft,
  draft,
  is.identity_line,
  identity_line,
  scale_x_log10,
  scale_y_log10,
  color.scales,
  ...
)

Arguments

ctr

pmx controller

which_pages

integer page(s) to display, or character "all" to display all pages (argument previously called npage, now deprecated)

print

logical if TRUE the ouptut will be a print not a ggplot2. This is useful for rmarkdwon output to avoid verbose list index print.

dname

character name of dataset to be used. User can create his own dataset using set_data and pass it as dname to be plotted.

pred_line

list some ipred line geom properties aesthetics

ipred_line

list some pred line geom properties aesthetics

point

list some point geom properties aesthetics

is.legend

logical if TRUE add a legend

use.finegrid

logical if FALSE use predictions data set

bloq

pmxBLOQ object created by pmx_bloq.

pmx_update parameters

filter

expression filter which will be applied to plotting data.

strat.facet

formula optional stratification parameter by facetting. This split plot by strats(each strat in a facet)

facets

list facet_wrap parameters.

strat.color

character optional stratification parameter by grouping. This will split the plot by group (color) of strat.

trans

character define the transformation to apply on x or y or both variables

pmxgpar

a object of class pmx_gpar possibly the output of the

pmx_gpar: Shared basic graphics parameters

labels

list list containing plot and/or axis labels: title, subtitle, x , y

axis.title

list containing element_text attributes to customize the axis title. (similar to ggplot2 axis.title theme)

axis.text

list containing element_text attributes to customize the axis text (similar to ggplot2 axis.text theme)

ranges

list limits of x/y ranges

is.smooth

logical if set to TRUE add smooth layer

smooth

list geom_smooth graphical/smoothing fun parameters

is.band

logical if TRUE add horizontal band

band

list horizontal band parameters. geom_hline graphical parameters.

is.draft

logical if TRUE add draft layer

draft

list draft layer parameters. geom_text graphical parameters.

is.identity_line

logical if TRUE add an identity line

identity_line

listgeom_abline graphical parameters.

scale_x_log10

logical if TRUE use log10 scale for x axis.

scale_y_log10

logical if TRUE use log10 scale for y axis.

color.scales

list define scales parameter in case of strat.color pmx_settings

...

others graphics parameters passed :

  • pmx_gpar internal function to customize shared graphical parameters

  • individual generic object for individual plots.

  • pmx_update function.

individual parameters

Value

ggplot2 or list of ggplot2 objects

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# basic use  ---------------------------------------

ctr <- theophylline()
ctr %>% pmx_plot_individual(which_pages = 1)
## multiple pages
ctr %>% pmx_plot_individual(which_pages = c(1, 3))
## change faceting
ctr %>% pmx_plot_individual(facets = list(nrow = 5, ncol = 5), which_pages = 2)


# update graphical parameter  ----------------------

## update labels
ctr %>% pmx_plot_individual(
  labels = list(title = "Custom individual plot")
)

## remove draft
ctr %>% pmx_plot_individual(is.draft = FALSE)

## Customize ipred_line with any geom_line parameter
ctr %>% pmx_plot_individual(
  pred_line = list(color = "red", linetype = 20, alpha = 0.5)
)

## Customize ipred_line with any geom_line parameter
ctr %>% pmx_plot_individual(
  ipred_line = list(size = 5)
)


## Customize any geom_point parameter
ctr %>% pmx_plot_individual(
  point = list(aes(alpha = DV), color = "green", shape = 4)
)


## legend

p <- ctr %>% pmx_plot_individual(
  is.legend=TRUE,
  point=list(shape=20),
  pred_line=list(linetype=6)
)

# # stratification  ----------------------------------
#
# ## continuous stratification
ctr %>% pmx_plot_individual(strat.color = "WT0")

# # subsetting  --------------------------------------
#
# ## we can use any expression involving the data
# ## filter and stratify
ctr %>% pmx_plot_individual(
  filter = SEX == 1, strat.facet = ~SEX, 
  facets = list(nrow = 5, ncol = 5))

# # transformation  --------------------------------------
#
# ## apply a log transformation in y
ctr %>% pmx_plot_individual(trans = "log10_y")
# ## apply a custonm trsnformation to normalize axis between 0 and 1

## get a list of parameter
p <- ctr %>% pmx_plot_individual(
  which_pages="all",
  point=list(shape=4,color='blue',size=10),
  facets = list(nrow = 5, ncol = 5),
  labels = list(title = "My individuals",x='my time',y='PD data')
) 

ggPMX documentation built on Sept. 20, 2021, 5:09 p.m.