# Strange behavior of plot---plot successful only if it is the last line of the code

**URL:** <https://discourse.julialang.org/t/strange-behavior-of-plot-plot-successful-only-if-it-is-the-last-line-of-the-code/108952>\
**Category:** Visualization\
**Tags:** plots\
**Created:** [January 18, 2024, 11:52am UTC](https://discourse.julialang.org/t/strange-behavior-of-plot-plot-successful-only-if-it-is-the-last-line-of-the-code/108952 "2024-01-18T11:52:01Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![rafael.guerra](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rafael.guerra/32/216610_2.png) [@rafael.guerra](https://discourse.julialang.org/u/rafael.guerra)\
**Post date:** [January 18, 2024, 3:17pm UTC](https://discourse.julialang.org/t/strange-behavior-of-plot-plot-successful-only-if-it-is-the-last-line-of-the-code/108952/6 "2024-01-18T15:17:41Z")

</div>

> [@jiang\_ming\_zhang](#):
>
> But what if I have more than two figures to plot?

With Plots.jl you have two options: (i) `plot(p, p2)` , (ii) create two separate windows.  
The latter works for a number of backends - [see this thread](https://discourse.julialang.org/t/how-to-display-multiple-plot-windows).

---

_[View the full topic](https://discourse.julialang.org/t/strange-behavior-of-plot-plot-successful-only-if-it-is-the-last-line-of-the-code/108952)._
