I call the ggplot package in Julia as shown in this website: https://avt.im/blog/2018/03/23/R-packages-ggplot-in-julia. I use the package as shown in that website and everything works fine.
Now i plot the average marginal effects in Julia using the Effects
package. I want to plot it using ggplot
here is the data i have:
df = effects(design, m1)
Here is my ggplot code and the error:
ggplot(df, aes(unemploy, workhours, group = sex, shape= sex, linetype=sex)) +
geom_point(position=position_dodge(width=0.15)) +
geom_errorbar(aes(ymin = lower, ymax = upper),width = 0.1,
linetype = "solid",position=position_dodge(width=0.15))+
geom_line(position=position_dodge(width=0.15))
UndefVarError: sex not defined
Stacktrace:
[1] top-level scope
@ In[131]:1
[2] eval
@ ./boot.jl:360 [inlined]
[3] include_string(mapexpr::typeof(REPL.softscope), mod::Module, code::String, filename::String)
@ Base ./loading.jl:1116
I tried this code before in R on the same dataframe and it worked fine, so the problem i guess is that ggplot is not reading the data as it should. Could someone help me to get around this problem?