# Wolfram Function Repository

Instant-use add-on functions for the Wolfram Language

Function Repository Resource:

Create markers carefully designed for creation of publication-quality plots

Contributed by:
Alexey Popkov
| AlexeyPopkov

ResourceFunction["PolygonMarker"][" returns a unit area Polygon describing the shape " | |

ResourceFunction["PolygonMarker"][{ returns a unit area Polygon with shape described by points { | |

ResourceFunction["PolygonMarker"][ returns | |

ResourceFunction["PolygonMarker"][ returns | |

ResourceFunction["PolygonMarker"][ returns a Graphics object suitable for PlotMarkers where the style of | |

ResourceFunction["PolygonMarker"][All] returns the list of names of predefined shapes. |

The basic usage syntax is ResourceFunction["PolygonMarker"][*shape*,*spec*], where *shape* is the name of a predefined shape or a list of 2D coordinates describing a simple polygon, and *spec* can be either *size* or {*size*, *angle*}.

The *angle* in radians determines the angle of counterclocwise rotation of *shape* about its centroid.

ResourceFunction["PolygonMarker"][*shape*,*spec*] returns a Polygon graphics primitive that can be used in Graphics.

ResourceFunction["PolygonMarker"][*shape*,*spec*,*style*], where *style* is a list of graphics directives applied to *shape*, returns a Graphics object which can be used as a marker for PlotMarkers.

ResourceFunction["PolygonMarker"][*shape*,*spec*,*style*,*options*] returns a Graphics object with *options* applied.

The centroid of Polygon generated by ResourceFunction["PolygonMarker"] is always placed at {0,0} in the internal coordinate system of Graphics.

ResourceFunction["PolygonMarker"][*shape*,*spec*,*positions*], where *positions* is a list of 2D coordinates, evaluates to Translate[ResourceFunction["PolygonMarker"][*shape*,*spec*],*positions*]. It represents a collection of multiple identical copies of *shape* with centroids placed at *positions*.

With an Offset *size* specification, the plot marker has a fixed size specified in printer's points, independent of ImageSize.

ResourceFunction["PolygonMarker"][*shape*,*size*] returns a Polygon with area *size*^{2} in the internal coordinate system of Graphics. ResourceFunction["PolygonMarker"][*shape*,Offset[*size*]] returns a Polygon with area *size*^{2} square printer’s points. The area taken by the boundary of the returned Polygon isn’t taken into account.

ResourceFunction["PolygonMarker"][All] and ResourceFunction["PolygonMarker"][] both return the complete list of names of predefined shapes.

Create a unit area Polygon object of "TripleCross" type rotated counterclockwise by :

In[1]:= |

Out[1]= |

The centroid of the polygon is placed at {0,0}:

In[2]:= |

Out[2]= |

Visualize the polygon and its centroid:

In[3]:= |

Out[3]= |

Create a tuned up Graphics marker in one step:

In[4]:= |

Out[4]= |

This marker is set up to be suitable for PlotMarkers:

In[5]:= |

Out[5]= |

Get the complete list of built-in named shapes:

In[6]:= |

Out[6]= |

Make a Grid of Buttons with the shapes for easy selection:

In[7]:= |

Out[7]= |

Filled markers that pick up PlotStyle and PlotTheme automatically:

In[8]:= |

In[9]:= |

In[10]:= |

Out[10]= |

In[11]:= |

In[12]:= |

Out[12]= |

Empty markers that pick up PlotStyle and PlotTheme automatically:

In[13]:= |

In[14]:= |

In[15]:= |

Out[15]= |

In[16]:= |

In[17]:= |

Out[17]= |

Filled markers with lighter filling colors:

In[18]:= |

Out[15]= |

Use the third argument of PolygonMarker to specify the coordinate(s) where the marker should be placed:

In[19]:= |

Out[19]= |

Construct a list plot directly from graphics primitives:

In[20]:= |

Out[16]= |

Construct a custom list plot where open plot markers have transparent faces for each other (but not for the lines):

In[21]:= |

Out[17]= |

Center markers that pick up PlotStyle and PlotTheme automatically:

In[22]:= |

Out[15]= |

Half-filled markers that pick up PlotStyle and PlotTheme automatically:

In[23]:= |

Out[15]= |

In[24]:= |

Out[25]= |

In[26]:= |

Out[5]= |

Contrast markers that pick up PlotStyle and PlotTheme automatically:

In[27]:= |

Out[15]= |

In[28]:= |

Out[29]= |

Create an auxiliary function that (approximately) converts a simple glyph into a set of points suitable for PolygonMarker:

In[30]:= |

Show a set of markers in use, including some created from glyphs:

In[31]:= |

Out[31]= |

Black-and-white plot, where the markers overlap considerably:

In[32]:= |

Out[28]= |

Use the resource functions RoundedPolygon and NotchedPolygon to make markers:

In[33]:= |

Out[33]= |

- Alexey Popkov, "How can we make publication-quality PlotMarkers without version 10?", (2017), Mathematica StackExchange.
- Alexey Popkov, "How to make plot marker sizes for scientific plots seem consistent?", (2014), Graphic Design StackExchange.
- Alexey Popkov, "Best plotting symbols for scientific plots with multiple datasets", (2014), Graphic Design StackExchange.
- Alexey Popkov, "Where can I find a large palette / set of contrasting colors for coloring many datasets on a plot?", (2014), Graphic Design StackExchange.
- Alexey Popkov, "How can I adaptively simplify a curved shape?", (2017), Mathematica StackExchange.

This work is licensed under a Creative Commons Attribution 4.0 International License