Hi,
does someone have an example on how to use RCall.jl? I’d like to take a julia DataFrame, move that data into an R session and then call ggplot2 on it. But right now the package has no tutorial, or example or any hint for a beginner on how to use it :) Any example of how to use that package works would be appreciated.
Thanks,
David
--
David Anthoff
University of California, Berkeley
--
You received this message because you are subscribed to the Google Groups "julia-stats" group.
To unsubscribe from this group and stop receiving emails from it, send an email to julia-stats...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
julia> R"library(ggplot2)";
julia> R"qplot(x, y, data = $df, colour = factor(tp))"
Sorry the documentation isn't great, part of the problem here is that we've been experimenting a lot with different approaches.My recommendation would be to use the R"" string macro:julia> R"library(ggplot2)";
julia> R"qplot(x, y, data = $df, colour = factor(tp))"
This is absolutely fantastic, what a hidden gem!
This might also be the best way to produce high quality graphs from julia at the moment, right?
I feel this whole approach should be made much more well known, I think many more people would be willing to use julia for their day-to-day work if they knew that they could easily use e.g. ggplot2 for plotting, and things like dplyr for data transformation etc.
Yeah, I really like the work on PlotlyJS.jl.
Having said that, at this point I see a whole bunch of really good things about using ggplot2 via RCall:
- There are a gazillion examples, tutorials etc. out there on the web on how to create any type of graph imaginable. Makes it much more approachable for many users.
- It has a grammar of graphics API. Many people really like that. The only other julia package that seems to support that is Gadfly (but that seems to have vastly less features than ggplot2).
- It is stable. They have released a 1.0, so most likely my plotting code will still work in half a year. Many of the julia plotting packages right now seem under pretty heavy dev.
- Generally transferability of skills. There are probably a couple hundred thousand people out there that know how to use ggplot2, if they can all bring that knowledge across to julia with so little effort, it seems a major positive that we as the julia community might to highlight.
I’m not at all saying that I don’t like the more homegrown plotting approaches in julia, but at this point ggplot2 seems just way, way more mature, and at least I was really surprised today how super simple it is to use it from within julia.
Cheers,
David
I’m actually not that familiar with dplyr, so I can’t tell. But there are just a lot of people who have built up a lot of skill in using dplyr, and this makes it easy for them to continue to use those skills.
Thanks, that is also helpful!
Simon actually wrote a really short Getting Started in the meantime, that essentially covers everything I had wanted to know:
http://juliastats.github.io/RCall.jl/latest/gettingstarted/
--
This looks nice!
Having said that, I really like a grammar of graphics API, so having ggplot2 available now is just great (and as far as I know the only other grammar of graphic like package accessible from julia is Gadfly, right?)
From: julia...@googlegroups.com [mailto:julia...@googlegroups.com] On Behalf Of Tom Breloff
Sent: Thursday, April 28, 2016 7:25 PM
To: julia...@googlegroups.com
ggplot
(mydata100,
aes
(x =
factor
(
""
), fill = workshop) ) +
geom_bar
() +
coord_polar
(theta =
"y"
) +
scale_x_discrete
(
""
)
I very much doubt that you can create a proper grammar of graphics like API by just vcating args and kws like you describe. I once read (not carefully) the original book by Wilkinson, and properly implementing that seems like a major effort to me. This is *not* just a light API layer on top of some other API. I’m sure one could create such a gg API that then calls into Plots, but I think it would be a lot of work and would require an intimate familiarity with the whole gg philosophy to get the design right. Wickham’s writing on this would probably be also really helpful.
What I like about a gg API is pretty well described in either Wilkinson’s book, or for example Wickham’s ggplot2 book intro chapter.
I see the benefits one can get from Plots that you describe, but those are all things that I don’t need in my kind of work. Having a package that is super well documented, where there are a gazillion tutorials, examples etc. available and where I can be pretty sure that any type of graph that I might ever want to create can probably be done by far outweighs the downside of having to mix julia and R. My sense is that there are a lot of academic people out there that would be in a similar situation.
Well, one of the nice things with ggplot2 is that even though I don’t use even a small fraction of it, I can be reasonably sure that anything I might want to use in the future is already there ;) So yes, that cheat sheet summarizes what I’ve been using. I would recommend to read the Wilkinson book before you start with this, the key point about a gg API is not a list like this cheat sheet, but rather the underlying consistent grammar, and I don’t think one can grasp that without reading the book…