# Plots.jl/Jupyter figure?

**URL:** <https://discourse.julialang.org/t/plots-jl-jupyter-figure/9925>\
**Category:** General Usage\
**Created:** [March 23, 2018, 4:27pm UTC](https://discourse.julialang.org/t/plots-jl-jupyter-figure/9925 "2018-03-23T16:27:38Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![gideonsimpson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gideonsimpson/32/1928_2.png) [@gideonsimpson](https://discourse.julialang.org/u/gideonsimpson)\
**Post date:** [March 23, 2018, 4:27pm UTC](https://discourse.julialang.org/t/plots-jl-jupyter-figure/9925/1 "2018-03-23T16:27:38Z")

</div>

I’ve slowly been moving over from `PyPlot` to `Plots.jl` and one thing that seems missing is an analog of `figure()`. This shows up when I have a cell in a Jupyter notebook, and I want to create several plots, one after another. While I can create a new cell for each plot, there were times when it made sense to organize them all together into a single cell.

---

<div class="post-metadata">

**Author:** ![non-Jedi](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/non-jedi/32/3645_2.png) [@non-Jedi](https://discourse.julialang.org/u/non-Jedi)\
**Post date:** [March 23, 2018, 4:50pm UTC](https://discourse.julialang.org/t/plots-jl-jupyter-figure/9925/2 "2018-03-23T16:50:50Z")

</div>

I’m not a heavy user of Plots.jl (yet), but I couldn’t believe the functionality  
you’re looking here was really lacking. I spent about 90 seconds in the docs and  
found references to [@layout](http://docs.juliaplots.org/latest/layouts/), which  
I’m pretty sure is what you’re looking for. Or is there functionality in  
matplotlib figures beyond what you have with `layout` that I’m not aware of?

EDIT: The section on layouts is hidden away on the “advanced topics” part of the  
docs, which seems ridiculous.

---

<div class="post-metadata">

**Author:** ![gideonsimpson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gideonsimpson/32/1928_2.png) [@gideonsimpson](https://discourse.julialang.org/u/gideonsimpson)\
**Post date:** [March 23, 2018, 4:52pm UTC](https://discourse.julialang.org/t/plots-jl-jupyter-figure/9925/3 "2018-03-23T16:52:51Z")

</div>

`layout` seems to really be for doing subplots (which my be what I should be doing). I was looking for something that would just allow me to open up a new figure and plot in it.

---

<div class="post-metadata">

**Author:** ![non-Jedi](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/non-jedi/32/3645_2.png) [@non-Jedi](https://discourse.julialang.org/u/non-Jedi)\
**Post date:** [March 23, 2018, 4:54pm UTC](https://discourse.julialang.org/t/plots-jl-jupyter-figure/9925/4 "2018-03-23T16:54:05Z")

</div>

Can you give me a concrete example of this workflow? I’m not sure I understand.

Afaict, a [matplotlib figure](https://matplotlib.org/api/figure_api.html) is  
just a container to hold some subplots.

EDIT: not sure if it’s possible to change it at this point, but this question  
probably fits into [the vizualizations section of discourse](https://discourse.julialang.org/c/domain/viz).

---

<div class="post-metadata">

**Author:** ![gideonsimpson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gideonsimpson/32/1928_2.png) [@gideonsimpson](https://discourse.julialang.org/u/gideonsimpson)\
**Post date:** [March 23, 2018, 4:58pm UTC](https://discourse.julialang.org/t/plots-jl-jupyter-figure/9925/5 "2018-03-23T16:58:16Z")

</div>

```julia
using PyPlot

x= linspace(0,10)
figure()
plot(x,sin.(x))
figure()
plot(x,cos.(x))

```

---

<div class="post-metadata">

**Author:** ![non-Jedi](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/non-jedi/32/3645_2.png) [@non-Jedi](https://discourse.julialang.org/u/non-Jedi)\
**Post date:** [March 23, 2018, 5:09pm UTC](https://discourse.julialang.org/t/plots-jl-jupyter-figure/9925/6 "2018-03-23T17:09:31Z")

</div>

You can force anything to show up in the jupyter output cell using the `display`  
function. So my minimal example of getting the same thing with Plots.jl would be:

```julia
using Plots
display(plot(sin, 0:0.1:10))
display(plot(cos, 0:0.1:10))

```
