# Wolfram Function Repository

Instant-use add-on functions for the Wolfram Language

Function Repository Resource:

Create markers carefully designed for the creation of publication-quality plots

Contributed by:
Alexey Popkov

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

ResourceFunction["PolygonMarker"][{ returns a unit area Polygon with a 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 the counterclockwise 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 that can be used as a marker for PlotMarkers.

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

The centroid of the 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 and *spec* contains a numeric specification for *size*, returns a list of Polygon graphics primitives with centroids placed at *positions*.

ResourceFunction["PolygonMarker"][*shape*,*spec*,*positions*], where *positions* is a list of 2D coordinates and *spec* contains Scaled or Offset specifications for *size*, 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 is not 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 * π*/6:

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 displaced 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[18]= |

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[20]= |

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

In[21]:= |

Out[21]= |

Construct a custom list plot where the plot lines do not go through the plot markers (the corresponding portions of the lines are explicitly removed). Other objects like grid lines and background are visible through the markers.

First, define auxiliary functions:

In[22]:= |

Input:

In[23]:= |

Plotting:

In[24]:= |

Out[24]= |

Center markers that pick up PlotStyle and PlotTheme automatically:

In[25]:= |

Out[25]= |

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

In[26]:= |

Out[26]= |

In[27]:= |

Out[27]= |

In[28]:= |

Out[28]= |

Contrast markers that pick up PlotStyle and PlotTheme automatically:

In[29]:= |

Out[29]= |

In[30]:= |

Out[30]= |

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

In[31]:= |

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

In[32]:= |

Out[32]= |

Black and white plot, where the markers overlap considerably:

In[33]:= |

Out[33]= |

Use the resource functions RoundedPolygon and NotchedPolygon to make markers:

In[34]:= |

Out[34]= |

- AlexeyPopkov GitHub–PolygonPlotMarkers
- How Can We Make Publication-Quality PlotMarkers without Version 10?–Mathematica Stack Exchange
- How to Make Plot Marker Sizes for Scientific Plots Seem Consistent?–Graphic Design Stack Exchange
- Best Plotting Symbols for Scientific Plots with Multiple Datasets–Graphic Design Stack Exchange
- Where Can I Find a Large Palette/Set of Contrasting Colors for Coloring Many Datasets on a Plot?–Graphic Design Stack Exchange
- How Can I Adaptively Simplify a Curved Shape?–Mathematica Stack Exchange

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