# Using arbitrary polygons as markers in Makie.jl

**URL:** <https://discourse.julialang.org/t/using-arbitrary-polygons-as-markers-in-makie-jl/53690>\
**Category:** New to Julia\
**Tags:** plotting, makie\
**Created:** [January 20, 2021, 10:44pm UTC](https://discourse.julialang.org/t/using-arbitrary-polygons-as-markers-in-makie-jl/53690 "2021-01-20T22:44:26Z")\
**Posts on this page:** 1\
**Showing post:** 13

<div class="post-metadata">

**Author:** ![yakir12](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yakir12/32/297_2.png) [@yakir12](https://discourse.julialang.org/u/yakir12)\
**Post date:** [September 29, 2021, 8:31am UTC](https://discourse.julialang.org/t/using-arbitrary-polygons-as-markers-in-makie-jl/53690/13 "2021-09-29T08:31:33Z")

</div>

> [@sijo](#):
>
> ```julia-auto
> p = Polygon([Point2f0(0), Point2f0(1), Point2f0(1,0)]);
> meshscatter(rand(Point2f0, 10), marker=GeometryBasics.mesh(p), color=:red)
> 
> ```

This solution works nicely, but as with the `poly` solution, I’m wondering if there’s a way to change the space-units from data to pixel. When you zoom in on a regular scatter-marker the size of the marker doesn’t change, which is great. I would have liked to be able to create a custom marker (from a polygon) that behaves similarly.

## For more context

I’m trying to create and use a new rotated drop-shaped marker, which works really well following the docs [https://makie.juliaplots.org/stable/documentation/recipes/index.html#multiple\_argument\_conversion\_with\_convert\_arguments:](https://makie.juliaplots.org/stable/documentation/recipes/index.html#multiple_argument_conversion_with_convert_arguments:)

```julia-auto
using CoordinateTransformations, Rotations

struct DirectedDrop{T<:AbstractVector}
  c::T
  θ::Float64
end

function Makie.convert_arguments(::PointBased, x::DirectedDrop)
  f = Translation(x.c) ∘ LinearMap(Angle2d(x.θ))
  n = 64
  ([f(Point2f(cos(t), sin(t)*sin(t/2)^2)) for t in range(0, 2π, n + 1)[1:end-1]], )
end

c = Point2f(2,3)
dd = Node(DirectedDrop(c, 0.0))
poly(dd, axis = (aspect = DataAspect(), ))

```

 ![a](https://global.discourse-cdn.com/julialang/original/3X/7/2/72d13997fb10c02b00c97d1c3a3cbbfdf984fd40.png)

My question is, what is the best way to plug in the whole interplay between `MarkerSpace` versus `DataSpace`? And as a side-question, in the decomposition of my `DirectedDrop`, what is the correct way to specify the number of vertices I use to create the drop (right now, I just have it hard-coded to 64)?

---

_[View the full topic](https://discourse.julialang.org/t/using-arbitrary-polygons-as-markers-in-makie-jl/53690)._
