# How to plot 2D polygons / shapes in Julia and color surfaces?

**URL:** <https://discourse.julialang.org/t/how-to-plot-2d-polygons-shapes-in-julia-and-color-surfaces/42552>\
**Category:** New to Julia\
**Tags:** plotting, polygons\
**Created:** [July 5, 2020, 12:45pm UTC](https://discourse.julialang.org/t/how-to-plot-2d-polygons-shapes-in-julia-and-color-surfaces/42552 "2020-07-05T12:45:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![gedankenexperiment](https://avatars.discourse-cdn.com/v4/letter/g/a183cd/32.png) [@gedankenexperiment](https://discourse.julialang.org/u/gedankenexperiment)\
**Post date:** [July 5, 2020, 12:45pm UTC](https://discourse.julialang.org/t/how-to-plot-2d-polygons-shapes-in-julia-and-color-surfaces/42552/1 "2020-07-05T12:45:45Z")

</div>

I have a dataframe that contains the spatial coordinates of polygons as columns x,y, their ID as a column and another column according tho whose values I would like to color the surfaces. Do you have suggestions on how to approach this? In R this is quite straightforward, but I already fail in plotting surfaces by using XY coordinates in Julia.

---

<div class="post-metadata">

**Author:** ![gedankenexperiment](https://avatars.discourse-cdn.com/v4/letter/g/a183cd/32.png) [@gedankenexperiment](https://discourse.julialang.org/u/gedankenexperiment)\
**Post date:** [July 5, 2020, 1:51pm UTC](https://discourse.julialang.org/t/how-to-plot-2d-polygons-shapes-in-julia-and-color-surfaces/42552/3 "2020-07-05T13:51:47Z")

</div>

```julia
using Plots;
plot([Shape(df.x, df.y)], group=df.ID,fill_z=df.value)

```

This plots arbitrary shapes that are stored in a dataframe with x,y,ID,value columns.
