Chris, in addition to being the driving force behind DifferentialEquations.jl, did some amazing work getting the startup time down for the service and it now feels pretty snappy. It’s been a great learning experience, and we now have a good idea for what goes into deploying a julia-driven website on a service like Heroku.
If you see any issues or have any suggestions, please let us know! In the meantime, enjoy a Lorenz attractor!
Gadfly plots are by default rendered onto a new tab in your browser. These plots are mildly interactive: you can zoom and pan across the plot area. You can also save plots directly to files of various formats.
Let’s load up some data from the nlschools dataset in R’s MASS package and look at the relationship between language score test and IQ for pupils broken down according to whether or not they are in a mixed-grade class.
Those two examples just scratched the surface. Gadfly can produce histograms, boxplots, ribbon plots, contours and violin plots. There’s detailed documentation with numerous examples on the homepage.
Watch the video below (Daniel Jones at JuliaCon 2014) then read on about Bokeh and Plotly.
Bokeh
Bokeh is a visualisation library for Python. Bokeh, like D3, renders plots as Javascript, which is viewable in a web browser. In addition to the examples on the library homepage, more can be found on the homepage for Julia’s Bokeh package.
The first thing you’ll need to do is install the Bokeh library. If you already have a working Python installation then this is easily done from the command line:
$ pip install bokeh
Next load up the package and generate a simple plot.
julia> using Bokeh
julia> autoopen(true);
julia> x = linspace(0, pi);
julia> y = cos(2 * x);
julia> plot(x, y, title = "Cosine")
Plot("Cosine" with 1 datacolumns)
The plot will be written to a file bokeh_plot.html in the working directory, which will in turn be opened by the browser. Use plotfile() to change the name of the file. The plot is interactive, with functionality to pan and zoom as well as resize the plot window.
Plotly
The Plotly package provides a complete interface to plot.ly, an online plotting service with interfaces for Python, R, MATLAB and now Julia. To get an idea of what’s possible with plot.ly, check out their feed. The first step towards making your own awesomeness with be loading the package.
using Plotly
Next you should set up your plot.ly credentials using Plotly.set_credentials_file(). You only need to do this once because the values will be cached.
You can either open the URL provided in the result dictionary or do it programatically:
julia> Plotly.openurl(ans["url"])
By making small jumps through similar hoops it’s possible to create some rather intricate visualisations like the 3D scatter plot below. For details of how that was done, check out my code on github.
Obviously plotting and visualisation in Julia are hot topics. Other plotting packages worth checking out are PyPlot, Winston and Gaston. Come back tomorrow when we’ll take a look at using physical units in Julia.