Search code examples
pythonmatplotlibsymbols

matplotlib - symbol to use for a vessel


I don't know the name for it (does anyone know what it's called?) but i'm curious if matplotlib has a symbol such as this? enter image description here (https://www.marinetraffic.com/img/shipicons/blue1_85.png)

For reference, this is taken from https://www.marinetraffic.com/en/ais/home/centerx:-12.0/centery:24.9/zoom:4

I believe this is the current list of symbols https://matplotlib.org/3.1.1/api/markers_api.html

Edit: Here the marker created by the code below. Thanks @ted930511

Edit 2: Slightly updated version of using vertices = [(0, 0), (-1, 1), (1, 1), (4, 0), (1, -1), (-1, -1), (0, 0)]

enter image description here


Solution

  • You can use Path to create custom marker. Details see here

    from matplotlib.path import Path
    vertices = [(0, 0), (-1, 1), (1, 1), (2, 0), (1, -1), (-1, -1), (0, 0)]
    p = Path(vertices,[1,2,2,2,2,2,79])
    
    x = range(10)
    y = x
    
    plt.scatter(x, y, marker=p, s=300)
    

    enter image description here