# Rectangle using pyplot vs. gr?

**URL:** <https://discourse.julialang.org/t/rectangle-using-pyplot-vs-gr/51117>\
**Category:** General Usage\
**Created:** [December 2, 2020, 2:09pm UTC](https://discourse.julialang.org/t/rectangle-using-pyplot-vs-gr/51117 "2020-12-02T14:09:21Z")\
**Posts on this page:** 2\
**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:** [December 2, 2020, 2:09pm UTC](https://discourse.julialang.org/t/rectangle-using-pyplot-vs-gr/51117/1 "2020-12-02T14:09:21Z")

</div>

Using `pyplot` as backend, the following draws a rectangle:

```julia
pyplot()
plot([(1,1),(5,1),(5,3),(1,3),(1,1)])

```

while if I change `pyplot()` to `gr()`, a partial rectangle is drawn, and then an error message is generated: `GKS: Rectangle definition is invalid in routine SET_VIEWPORT`

**Question** : Why?

---

<div class="post-metadata">

**Author:** ![lmiq](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lmiq/32/18314_2.png) [@lmiq](https://discourse.julialang.org/u/lmiq)\
**Post date:** [December 2, 2020, 2:28pm UTC](https://discourse.julialang.org/t/rectangle-using-pyplot-vs-gr/51117/2 "2020-12-02T14:28:29Z")

</div>

I do not get any error using `gr()` with that. But just to add, if you want to control the fill of the rectangle, etc, you can use:

```julia
julia> using Plots
julia> plot([(1,1),(5,1),(5,3),(1,3),(1,1)],
            seriestype=:shape,fillcolor=:green,linecolor=:blue,linewidth=3)

```

![square](https://global.discourse-cdn.com/julialang/original/3X/f/3/f38c2453ac8c2f124b8f7cccc732be179f6a696a.png)
