Book Image

Interactive Visualization and Plotting with Julia

By : Diego Javier Zea
Book Image

Interactive Visualization and Plotting with Julia

By: Diego Javier Zea

Overview of this book

The Julia programming language offers a fresh perspective into the data visualization field. Interactive Visualization and Plotting with Julia begins by introducing the Julia language and the Plots package. The book then gives a quick overview of the Julia plotting ecosystem to help you choose the best library for your task. In particular, you will discover the many ways to create interactive visualizations with its packages. You’ll also leverage Pluto notebooks to gain interactivity and use them intensively through this book. You’ll find out how to create animations, a handy skill for communication and teaching. Then, the book shows how to solve data analysis problems using DataFrames and various plotting packages based on the grammar of graphics. Furthermore, you’ll discover how to create the most common statistical plots for data exploration. Also, you’ll learn to visualize geographically distributed data, graphs and networks, and biological data. Lastly, this book will go deeper into plot customizations with Plots, Makie, and Gadfly—focusing on the former—teaching you to create plot themes, arrange multiple plots into a single figure, and build new plot types. By the end of this Julia book, you’ll be able to create interactive and publication-quality static plots for data analysis and exploration tasks using Julia.
Table of Contents (19 chapters)
1
Section 1 – Getting Started
6
Section 2 – Advanced Plot Types
12
Section 3 – Mastering Plot Customization

Exploiting the interactivity of Plots backends

In the previous section, we have seen that multiple Plots backends offer interactivity out of the box—in particular, Gaston, InspectDR, PyPlot, Plotly, and PlotlyJS. Among those, Plotly and PlotlyJS provide the largest number of available interactive actions. So, let’s try the interactive capabilities of Plots utilizing the Plotly backend, as follows:

  1. Open the Julia REPL and execute using Plots to load the Plots package.
  2. Execute plotly() on the Julia REPL to use the Plotly backend that comes with Plots.
  3. Run the following code to generate example data:
    x = 0:0.1:2pi
    y_sin = sin.(x)
    y_cos = cos.(x)
  4. Execute plot(x, [y_sin y_cos], labels=["sin" "cos"]) to create a plot that would be rendered with Plotly. Let’s interact with it.
  5. Move the mouse over the plot; you will see that a toolbox appears on the top right. The options on the toolbox depend on the plot type, and they can also...