Python | Available Unfilled Markers in Matplotlib

In this article, we are going to explore different unfilled markers available in Python matplotlib?
Submitted by Anuj Singh, on August 21, 2020

Illustrations:

available unfilled markers

Python code for available unfilled markers in matplotlib

import matplotlib.pyplot as plt
from matplotlib.lines import Line2D

def axfmt(ax):
    ax.margins(0.2)
    ax.set_axis_off()
    ax.invert_yaxis()


def split(a_list):
    i_half = len(a_list) // 2
    return a_list[:i_half], a_list[i_half:]

fig, axs = plt.subplots(ncols=2)
fig.suptitle('Available Un-filled markers')

unfilled_markers = [m for m, func in Line2D.markers.items()
                    if func != 'nothing' and m not in Line2D.filled_markers]

for ax, markers in zip(axs, split(unfilled_markers)):
    for y, marker in enumerate(markers):
        ax.text(-0.5, y, repr(marker), horizontalalignment='right', 
                verticalalignment='center', fontsize=12, 
                fontfamily='monospace')
        
        ax.plot([y] * 3, marker=marker, linestyle=':', color='0.8', 
                markersize=10, markerfacecolor="tab:blue", 
                markeredgecolor="tab:blue")
    axfmt(ax)
plt.show()

Output:

Output is as Figure





Comments and Discussions

Ad: Are you a blogger? Join our Blogging forum.





Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates


© https://www.includehelp.com some rights reserved.