# Plots and Shape?

**URL:** <https://discourse.julialang.org/t/plots-and-shape/61501>\
**Category:** General Usage\
**Created:** [May 20, 2021, 8:28am UTC](https://discourse.julialang.org/t/plots-and-shape/61501 "2021-05-20T08:28:28Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![BLI](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bli/32/37206_2.png) [@BLI](https://discourse.julialang.org/u/BLI)\
**Post date:** [May 20, 2021, 8:28am UTC](https://discourse.julialang.org/t/plots-and-shape/61501/1 "2021-05-20T08:28:28Z")

</div>

I found the following code in this discourse (there seems to be a couple of versions of it):

```julia
import Plots as plt
ang = range(0, 2π, length = 60)
ellipse(x, y, w, h) = plt.Shape(w*sin.(ang).+x, h*cos.(ang).+y) # Returns a Shape object
myshapes = [ellipse(x,rand(),rand(),rand()) for x = 1:4]
plt.plot(myshapes)

```

and I think this worked a few weeks ago. But now it does not work…

The result is the same as the following code (which still works):

```julia
ang = range(0, 2π, length = 60)
ellipse(x, y, w, h) = w*sin.(ang).+x, h*cos.(ang).+y # Returns a tuple
myshapes = [ellipse(x,rand(),rand(),rand()) for x = 1:4]
plt.plot(myshapes,st=:shape)

```

and produces:

 ![image](https://global.discourse-cdn.com/julialang/original/3X/2/6/26112c1fe46573f319cc4f4696882478d05ef0ac.png)

_Question_: Has there been a breaking change in `Plots` so that `Shape` doesn’t work any more? [Or do I do something wrong?]

---

<div class="post-metadata">

**Author:** ![BeastyBlacksmith](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/beastyblacksmith/32/4741_2.png) [@BeastyBlacksmith](https://discourse.julialang.org/u/BeastyBlacksmith)\
**Post date:** [May 20, 2021, 1:04pm UTC](https://discourse.julialang.org/t/plots-and-shape/61501/2 "2021-05-20T13:04:21Z")

</div>

There were a few changes regarding shapes lately,  
such as  
[https://github.com/JuliaPlots/Plots.jl/pull/3436](https://github.com/JuliaPlots/Plots.jl/pull/3436)

does it work on 1.13.2?

---

<div class="post-metadata">

**Author:** ![BLI](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bli/32/37206_2.png) [@BLI](https://discourse.julialang.org/u/BLI)\
**Post date:** [May 20, 2021, 1:52pm UTC](https://discourse.julialang.org/t/plots-and-shape/61501/3 "2021-05-20T13:52:42Z")

</div>

I don’t understand what’s going on… Let `myshapes` be defined as [just so we know which `myshapes` version I’m talking about]:

```julia
ang = range(0, 2π, length = 60)
ellipse(x, y, w, h) = plt.Shape(w*sin.(ang).+x, h*cos.(ang).+y) # Returns a Shape object
myshapes = [ellipse(x,rand(),rand(),rand()) for x = 1:4]

```

1. I use `Plots v1.15.1`.
2. If I do `plt.plot(myshapes)`, I get an error message. Note: `myshapes` is a vector of `Shape`s.
3. If I instead do the following, then things _work_:

```julia
plt.plot()
for s in myshapes
    plt.plot!(s)
end
plt.plot!()

```

To me, this appears to be a bug in how the recipe “unpacks” the vector of `Shape`s???

Or is the recipe _changed_ so that it cannot plot _vectors_ of shapes?

---

<div class="post-metadata">

**Author:** ![BeastyBlacksmith](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/beastyblacksmith/32/4741_2.png) [@BeastyBlacksmith](https://discourse.julialang.org/u/BeastyBlacksmith)\
**Post date:** [May 20, 2021, 2:26pm UTC](https://discourse.julialang.org/t/plots-and-shape/61501/4 "2021-05-20T14:26:54Z")

</div>

> [@BLI](#):
>
> ```julia
> import Plots as plt
> ang = range(0, 2π, length = 60)
> ellipse(x, y, w, h) = plt.Shape(w*sin.(ang).+x, h*cos.(ang).+y) # Returns a Shape object
> myshapes = [ellipse(x,rand(),rand(),rand()) for x = 1:4]
> plt.plot(myshapes)
> 
> ```

I can confirm that this works on Plots 1.0.0, but not on 1.13.2. Can you open an issue on github? This is a good test example

---

<div class="post-metadata">

**Author:** ![BLI](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bli/32/37206_2.png) [@BLI](https://discourse.julialang.org/u/BLI)\
**Post date:** [May 20, 2021, 3:48pm UTC](https://discourse.julialang.org/t/plots-and-shape/61501/5 "2021-05-20T15:48:09Z")

</div>

> [@BeastyBlacksmith](#):
>
> Can you open an issue on github?

Done.

---

<div class="post-metadata">

**Author:** ![BeastyBlacksmith](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/beastyblacksmith/32/4741_2.png) [@BeastyBlacksmith](https://discourse.julialang.org/u/BeastyBlacksmith)\
**Post date:** [May 20, 2021, 7:17pm UTC](https://discourse.julialang.org/t/plots-and-shape/61501/6 "2021-05-20T19:17:39Z")

</div>

This should be fixed on 1.15.2

---

<div class="post-metadata">

**Author:** ![BLI](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bli/32/37206_2.png) [@BLI](https://discourse.julialang.org/u/BLI)\
**Post date:** [May 20, 2021, 7:30pm UTC](https://discourse.julialang.org/t/plots-and-shape/61501/7 "2021-05-20T19:30:21Z")

</div>

Seems to work!

Thanks a lot!!
