dv_pred(df)
“Layers” refer to different reference lines or smoothers that are added to plots by default.
Layers include
smoothhlineablineFor example, dv_pred() adds an identity line (y = x) for reference as well as a smoother through the data
These layers can all be customized or dropped from the plot altogether. This section shows you how to do that. We’ll work on this basic plot as well as plots that come right out of pmplots.
or
or
or
Set the layer to NULL to drop one or more of these layers from the plot.
You can also decline to add any layers through add_layers
For any layer type, you can pass a list of arguments that will get passed on to the appropriate geom.
For example, change the values of argument for ggplot2::geom_smooth()
The items in the list getting passed as smooth should be arguments in ggplot2::geom_smooth().
Similarly, you can set abline with a list of arguments to get passed to geom_abline() or hline with a list of arguments to get passed to geom_hline().
You can pass lists of arguments as xs or ys to modify the x- or y-axis, respectively. These arguments get passed to ggplot2::scale_x_continuous() or ggplot2::scale_y_continuous().
To modify the x-axis of a plot, pass a list of items as the xs argument; these items will get passed to ggplot2::scale_x_continuous().
For example, to make the x-axis log transformed and modify the breaks, write
Note: that you can modify the x-axis label of a plot without modifying the scale using ggplot2::xlab()
To modify the y-axis of a plot, pass a list of items as the ys argument; these items will get passed to ggplot2::scale_y_continuous().
For example, to make the y-axis log transformed and modify the breaks, write
There may also be a yname argument for a given plot that will let you directly change the y-axis label as in the example above.
Note: that you can modify the y-axis label of a plot without modifying the scale using ggplot2::ylab()
There are two types of functions to rotate x and y axis labels. One type is rot_x() and rot_y(); these get “added” into your ggplot (just like you would a geom). The other is rot_xy() which takes your ggplot object as the first argument.
We are typically rotating the tick labels on the x-axis and frequently it is convenient to ask for a totally vertical rendering
rot_xy()First, make a plot
Then, pass that plot into rot_xy() as the first argument. This is equivalent to p + rot_x()
You can work on the y-axis, turn vertical, etc
rot_xy() can work on patchwork objects
or lists of plots
etas <- paste0("ETA", 1:2)
pp <- eta_covariate(id, x = c("CPc", "WT"), y = etas)
pp <- rot_xy(pp, axis = "y")
pp$ETA3NULL
rot_xy() can work on a specific plot in a list
Currently, rot_xy() will apply axis rotation to all plots on a page.
If this is too cramped
Try this
[1] "TIME//Time {xunit}"
[1] "TAD//Time after dose {xunit}"
[1] "TAFD//Time after first dose {xunit}"
[1] "RES//Residual"
[1] "WRES//Weighted residual"
[1] "CWRES//CWRES"
[1] "CWRESI//CWRES with interaction"
[1] "NPDE//NPDE"
[1] "DV//Observed {yname}"
[1] "PRED//Population predicted {xname}"
[1] "IPRED//Individual predicted {xname}"
You can glue() in information with these functions
Similar with
And
Similar with
[1] 1e-10 3e-10 1e-09 3e-09 1e-08 3e-08 1e-07 3e-07 1e-06 3e-06 1e-05 3e-05
[13] 1e-04 3e-04 1e-03 3e-03 1e-02 3e-02 1e-01 3e-01 1e+00 3e+00 1e+01 3e+01
[25] 1e+02 3e+02 1e+03 3e+03 1e+04 3e+04 1e+05 3e+05 1e+06 3e+06 1e+07 3e+07
[37] 1e+08 3e+08 1e+09 3e+09 1e+10 3e+10
Default breaks
Break every 3 days
Custom breaks and limits