GR.jl Open two figures


#1

Hi,

I am using GR.jl and would like to open two figures. I also need to toggle between them in order to show changes of real-time data. In PyPlot.jl I would use figure(1) and figure(2) to switch between the figures.

Thanks,

Tobias

Ping: @jheinen


#2

If you are willing to use Plots.jl, the following should work:

plt = plot(title="My two figures", layout=(1,2))

# update figure 1
plot!(plt[1], rand(10), rand(10), kwargs...)

# update figure 2
histogram!(plt[2], rand(100))

# more figure 1
vline!(plt[1], [1,2,3])

I am not sure however how you can clean one of the subplots in the middle of the process. The commands with a bang (!) only append to the scene.


#3

thanks, but Plots.jl is not an option. My package load time is already large and Plots.jl adds too much overhead.


#4

The loading time of your package should be independent of Plots.jl if you implement the functionality with a recipe and RecipesBase.jl. I don’t know how to implement it easily though, recipes aren’t that trivial to digest.