Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

What are the matplotlib projects suitable for practice?

Shulou Source: shulou.com Published: 2022-06-01 09:58:55 11月16日 Update

This article is about what matplotlib projects are suitable for practice. Xiaobian thinks it is quite practical, so share it with everyone for reference. Let's follow Xiaobian and have a look.

For example, drawing basic polygon diagrams:

import numpy as np

import matplotlib.pyplot as plt

import matplotlib.tri as tri

data = np.random.rand(100, 2)

triangles = tri.Triangulation(data[:,0], data[:,1])

plt.triplot(triangles)

plt.show()

Plot Scatter Plot:

import numpy as np

import matplotlib.cm as cm

import matplotlib.pyplot as plt

N = 256

angle = np.linspace(0, 8 * 2 * np.pi, N)

radius = np.linspace(.5, 1., N)

X = radius * np.cos(angle)

Y = radius * np.sin(angle)

plt.scatter(X, Y, c = angle, cmap = cm.hsv)

plt.show()

Here the author introduces a solution for drawing multi-color maps, using colormaps.

Draw Polygon:

import numpy as np

import matplotlib.pyplot as plt

theta = np.linspace(0, 2 * np.pi, 8)

points = np.vstack((np.cos(theta), np.sin(theta))).transpose()

plt.figure(figsize=(4., 4.))

plt.gca().add_patch(plt.Polygon(points, color = '.75'))

plt.grid(True)

plt.axis('scaled')

plt.savefig('polygon.png', dpi = 128)

Thank you for reading! About "what are the matplotlib small projects suitable for practice" this article is shared here, I hope the above content can be of some help to everyone, so that everyone can learn more knowledge, if you think the article is good, you can share it for more people to see it!

Tags: Project content polygon more article good practical author article scheme look knowledge solution color reference help related Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Tech Info MySQL MariaDB Shulou Information Xiaomi