Unfortunately I cannot share data. This is a box plot with observed data points scattered with jitter.
isMD.labs <- c("SD", "MD")
names(isMD.labs) <- c("0", "1")
ggplot(tab_all, aes(x = as.factor(dose), y = cfb, color=as.factor(dose)))+
geom_boxplot(outlier.shape=NA)+
geom_jitter(shape=16,size=0.4, position=position_jitter(0.2))+
#scale_x_continuous(breaks = seq(0,20,6),
# limit = c(0,21))+
scale_y_continuous(breaks = seq(-25,50,25),
limit = c(-25,50))+
labs(x = "Dose (mg)",
y = "CFB")+
theme_bw(base_size = 16)+
theme(legend.position = "none") +
facet_wrap(~isMD, labeller = labeller(isMD = isMD.labs))
You can do the same with AlgebraOfGraphics.jl
which is a package inspired by ggplot2
:
plt = data(tab_all) *
mapping(
:dose => nonnumeric,
:cfb;
color=:dose => nonnumeric,
layout=:isMD => nonnumeric,
) *
visual(BoxPlot)
draw(plt;
axis=(; yticks=-25:50:25, limits=(nothing, nothing, -25, 50)),
figure=(; fontsize=16),
legend=(; position=:top, titleposition=:left),
)
We also have tons of publication-ready easy-to-use visualization functions for most of the pharmacometrics workflows. Don’t forget to check Plotting · Pumas.
Thank you @storopoli Three questions:
- Do we need to load AlgebraOfGraphics.jl ?
- I am assuming data() is a plots function; and tab_all is my dataframe? I get an error that ‘data’ does not exist.
- Can we pass pumas object into data()? For eg. can I pass inspect(myfit) or do I need to pass ‘DataFrame(inspect(myfit))’.
J
Yes in the same way you need to do library(ggplot)
to call the ggplot()
function in the original code. You need to do:
using AlgebraOfGraphics
using CairoMakie # backend
This is fixed with the using AlgebraOfGraphics
above
Almost all Pumas’ outputs can be easily converted to DataFrame
s with DataFrame(pumas_output)
.
So you can definitely do that with:
my_inspect = inspect(my_fit)
DataFrame(my_inspect)