Today I tried
Julia for the first time. I have read about it before, and kept considering whether or not it is worth learning another programming language (see e.g. Should I learn new programming langauge Julia?). And there are many thoughtful comments online on the benefits of Julia compared to other popular high-level programming languages like R, Python, MATLAB, etc. (here, or here), but there are also critical voices (like here). In any case, I decided to have a look at it anyway. My background is in
R, so learning
Julia should not be too much of a problem. Right?
While I have no problems using the terminal, I still prefer a good IDE. Yeah, I am that kind of person. Previously, I used
texstudioand am very happy with the additional functionality an IDE provides. I decided to install Juno, which is an extension for the Atom text editor. Simply search and install the
uber-junopackage within the Atom editor. It takes a while to load install all the dependencies. Once this is done a new Julia session is initiated. This first start up will also take a few moments.
2+2 into the console results in
4. Good, the first test was successful. Now, on to something more adventures. Plotting. I know, this might be too advanced for the first day, but hey, in
R plotting belongs to the core functions, and enjoy plotting my data and results. Simply type
plot(1:10) in an
R console and a plot will appear somewhere.
Great. So, how to do this in Julia? The Julialang website offers three different options for plotting:
Gadfly. In order they are the generic way of plotting in Julia, a variant relying on
matplotlib, and one that is similar to
ggplot2 . (I really like ggplot2 a lot, and in combination with
cowplot you can make really nice plots, so I guess, in the long run, I will stick with making plots in R).
First, install the
Plots package, then call it for the session by using
using and then let us plot 2 sets of data each with 10 random numbers:
Pkg.add("Plots") using Plots plot(rand(10,2))
And here we go. A quick way to plot:
Interestingly, the created figure is interactive. You can zoom in on data, and pan around. That’s certainly different from the generic R plot.
These first steps have definitely made me interested in exploring
Julia more. Less for plotting, but more for using it as my go to agent-based modelling language.