Matplotlib is a library in Python and it is numerical – mathematical extension for NumPy library. Pyplot is a state-based interface to a Matplotlib module which provides a MATLAB-like interface. There are various plots which can be used in Pyplot are Line Plot, Contour, Histogram, Scatter, 3D Plot, etc.
The triplot() function in pyplot module of matplotlib library is used to draw a unstructured triangular grid as lines and/or markers.
Syntax: matplotlib.pyplot.triplot(*args, **kwargs)
Parameters: This method accept the following parameters that are described below:
- x, y: These parameter are the x and y coordinates of the data which is to be plot.
- triangulation: This parameter is a matplotlib.tri.Triangulation object.
- **kwargs: This parameter is Text properties that is used to control the appearance of the labels.
All remaining args and kwargs are the same as for matplotlib.pyplot.plot().
Returns: This returns the list of 2 Line2D containing following:
- The lines plotted for triangles edges.
- The markers plotted for triangles nodes
Below examples illustrate the matplotlib.pyplot.triplot() function in matplotlib.pyplot:
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course