Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Display multiple plots with Plots.jl

Tags:

I currently have two vectors, x and y which I plot separately as in

using Plots
pyplot() # chooses pyplot background
x = rand(100); y = rand(100)
plt1 = plot(x)
display(plt1)
plt2 = plot(y)
display(plt2)

I have also tried the gui() and gui(plt1) functions, but these have a similar effect as the display(plt1) function. Also note that I am running this in a file (hence the necessity of the display() function). I have also tried similar code in the REPL, which has the same problem of only displaying the last plot I call.

My question is how do I display two different figures at the same time? My current implementation has plt2 overwrite plt1, so I am not able to see them at the same time. Note that I am not looking for making a subplot, but rather two distinct figures. Is there a figure() function similar to Matplotlib which allows declaration of separate figures?

like image 958
JBar Avatar asked Jun 07 '17 15:06

JBar


1 Answers

Yes, use the phrase plt2 = plot(y, reuse = false)

like image 197
Michael K. Borregaard Avatar answered Oct 04 '22 16:10

Michael K. Borregaard