Activating project at `~/Documents/github.com/ucla-biostat-257/2023spring/slides/04-juliaplot`
Status `~/Documents/github.com/ucla-biostat-257/2023spring/slides/04-juliaplot/Project.toml`
[c91e804a] Gadfly v1.3.4
[f0f68f2c] PlotlyJS v0.18.10
⌃ [91a5bcdd] Plots v1.38.8
[d330b81b] PyPlot v2.11.1
[6f49c342] RCall v0.13.14
[9a3f8284] Random
Info Packages marked with ⌃ have new versions available and may be upgradable.
To demonstrate Gadfly, we will go through an example and compare it to ggplot2.
usingRCallR"""library(ggplot2)library(dplyr)df <- ToothGrowth %>% group_by(supp, dose) %>% summarise(se = sd(len) / n(), len = mean(len), n = n())ggplot(df, aes(x = dose, y = len, group = supp, color = supp)) + geom_line() + geom_point() + geom_errorbar(aes(ymin = len - se, ymax = len + se), width = 0.1, alpha = 0.5, position = position_dodge(0.005)) + scale_color_manual(values = c(VC = "skyblue", OJ = "orange")) + labs(x = "Dose", y = "Tooth Length")"""
┌ Warning: RCall.jl:
│ Attaching package: ‘dplyr’
│
│ The following objects are masked from ‘package:stats’:
│
│ filter, lag
│
│ The following objects are masked from ‘package:base’:
│
│ intersect, setdiff, setequal, union
│
└ @ RCall ~/.julia/packages/RCall/Wyd74/src/io.jl:172
┌ Warning: RCall.jl: `summarise()` has grouped output by 'supp'. You can override using the
│ `.groups` argument.
└ @ RCall ~/.julia/packages/RCall/Wyd74/src/io.jl:172
RObject{VecSxp}
@rget df # retrieve dataframe from R to Julia workspaceusingGadflydf[!, :ymin] = df[!, :len] - df[!, :se]df[!, :ymax] = df[!, :len] + df[!, :se]Gadfly.plot(df, x =:dose, y =:len, color =:supp, Geom.point, Guide.xlabel("Dose"), Guide.ylabel("Tooth Length"), Guide.xticks(ticks = [0.5, 1.0, 1.5, 2.0]), Geom.line, Geom.errorbar, ymin =:ymin, ymax =:ymax, Scale.color_discrete_manual("orange", "skyblue"))
┌ Warning: RCall.jl: Warning: The `size` argument of `element_line()` is deprecated as of ggplot2 3.4.0.
│ ℹ Please use the `linewidth` argument instead.
└ @ RCall ~/.julia/packages/RCall/Wyd74/src/io.jl:172