SmoothLivePlot.jl
is a Julia package for creating live-style plots during calculations.
Updating the Juno plot plane during calculations creates new plots on top of the old ones. This produces a flickering effect e.g.:
- Can you update a plot in Julia?
- Current State of Live Plots in Atom/Juno?
- Suppress Plot Window when output to animation
To smoothly update of plots, I generalised a solution found by user ckneale. It uses Observables.jl and WebIO.jl so that the plot can listen to changes in its elements.
Currently, I have tested the following capabilities:
- Modifying values in X and/or Y array(s) in scatter and plot
- Modifying colours in scatter and plot
- Modifying text elements (e.g. titles, xlabels, etc...)
- Modifying matricies in contour plots
- Adding new elements to X,Y arrays in 2d line and scatter plots
- Adding new elements to X,Y,Z in 3d line and scatter plots
Note: this package is designed to work with the plot plane in Juno. If you force it to plot in a gui it will look really weird.
- Import the module using
using SmoothLivePlot
. - Create a live plot with macro
outPlotObject = @makeLivePlot myPlotFunction(argument1, argument2, ...)
.- Function
myPlotFunction(argument1, argument2, ...)
is a user defined plotting function. - Output
outPlotObject
is a mutable output array of plot features. Its elements are the input aruments ofmyPlotFunction()
.
- Function
- Modify plot elements with function
modifyPlotObject!(outPlotObject, arg2 = newArg2, arg1 = newArg1, ...)
.- The first argment of
modifyPlotObject!()
must be the mutable output array. - The following argments are optional and named. The name/value pair must be
arg<x> = newArg1
, where<x>
in the name is an integer that indicates the position of the argument in the original plotting functionmyPlotFunction()
. - E.g. to modify
argument2
tonewArgument2
, usemodifyPlotObject!(outPlotObject, arg2 = newArgument2)
. - The modified arguments do not have to be in any specific order, and are updated at the same time.
- The first argment of
Here's a video showing an output live-plot from some magnetohydrodynamic calculations:
- Add capability to add additional elements to plots.
- Benchmark performance.
- Version 0.1.0 - Introduced original version.