What is Matplotlib and what is its primary use?
Example:
import matplotlib.pyplot as plt
plt.plot([1, 2, 3, 4], [10, 20, 25, 30])
plt.show()
保存以便复习
保存以便复习
收藏此条目、标记为困难题,或将其加入复习集合。
WithoutBook 将分主题面试题、在线练习测试、教程和对比指南整合到一个响应式学习空间中。
了解热门 Python Matplotlib 面试题与答案,帮助应届生和有经验的候选人为求职面试做好准备。
了解热门 Python Matplotlib 面试题与答案,帮助应届生和有经验的候选人为求职面试做好准备。
搜索问题以查看答案。
Example:
import matplotlib.pyplot as plt
plt.plot([1, 2, 3, 4], [10, 20, 25, 30])
plt.show()
收藏此条目、标记为困难题,或将其加入复习集合。
Example:
plt.scatter([1, 2, 3, 4], [10, 20, 25, 30])
plt.show()
收藏此条目、标记为困难题,或将其加入复习集合。
Example:
plt.plot([1, 2, 3, 4], [10, 20, 25, 30])
plt.xlabel('X-axis')
plt.ylabel('Y-axis')
plt.show()
收藏此条目、标记为困难题,或将其加入复习集合。
Example:
plt.plot([1, 2, 3, 4], [10, 20, 25, 30])
plt.xlim(0, 5)
plt.ylim(0, 35)
plt.show()
收藏此条目、标记为困难题,或将其加入复习集合。
Example:
plt.plot([1, 2, 3, 4], [10, 20, 25, 30])
plt.grid(True)
plt.show()
收藏此条目、标记为困难题,或将其加入复习集合。
Example:
plt.bar([1, 2, 3, 4], [10, 20, 25, 30])
plt.show()
收藏此条目、标记为困难题,或将其加入复习集合。
Example:
plt.plot([1, 2, 3, 4], [10, 20, 25, 30])
plt.title('Line Chart')
plt.show()
收藏此条目、标记为困难题,或将其加入复习集合。
Example:
data = [1, 1, 2, 2, 2, 3, 3, 4, 4, 4, 4, 5]
plt.hist(data, bins=5, edgecolor='black')
plt.show()
收藏此条目、标记为困难题,或将其加入复习集合。
Example:
plt.subplot(2, 1, 1)
plt.plot([1, 2, 3, 4], [10, 20, 25, 30])
plt.subplot(2, 1, 2)
plt.scatter([1, 2, 3, 4], [10, 20, 25, 30])
plt.tight_layout()
plt.show()
收藏此条目、标记为困难题,或将其加入复习集合。
Example:
plt.barh(['A', 'B', 'C', 'D'], [10, 20, 25, 30])
plt.show()
收藏此条目、标记为困难题,或将其加入复习集合。
Example:
plt.plot([1, 2, 3, 4], [10, 20, 25, 30])
plt.savefig('plot.png')
收藏此条目、标记为困难题,或将其加入复习集合。
Example:
plt.plot([1, 2, 3, 4], [10, 20, 25, 30])
plt.scatter([1, 2, 3, 4], [10, 20, 25, 30])
plt.show()
收藏此条目、标记为困难题,或将其加入复习集合。
Example:
plt.plot([1, 2, 3, 4], [10, 20, 25, 30], label='Line 1')
plt.legend()
plt.show()
收藏此条目、标记为困难题,或将其加入复习集合。
Example:
plt.subplot(2, 1, 1)
plt.plot([1, 2, 3, 4], [10, 20, 25, 30])
plt.subplot(2, 1, 2)
plt.scatter([1, 2, 3, 4], [10, 20, 25, 30])
plt.show()
收藏此条目、标记为困难题,或将其加入复习集合。
Example:
plt.plot([1, 2, 3, 4], [10, 20, 25, 30])
plt.xticks([1, 2, 3, 4], ['A', 'B', 'C', 'D'])
plt.show()
收藏此条目、标记为困难题,或将其加入复习集合。
Example:
import matplotlib.image as mpimg
img = mpimg.imread('image.png')
plt.imshow(img)
plt.show()
收藏此条目、标记为困难题,或将其加入复习集合。
Example:
plt.plot([1, 2, 3, 4], [10, 20, 25, 30])
plt.text(2, 15, 'Annotation')
plt.show()
收藏此条目、标记为困难题,或将其加入复习集合。
Example:
sizes = [20, 30, 40, 10]
labels = ['A', 'B', 'C', 'D']
plt.pie(sizes, labels=labels, autopct='%1.1f%%')
plt.show()
收藏此条目、标记为困难题,或将其加入复习集合。
Example:
plt.plot([1, 2, 3, 4], [10, 20, 30, 40])
plt.xscale('log')
plt.yscale('log')
plt.show()
收藏此条目、标记为困难题,或将其加入复习集合。
Example:
x = [1, 2, 3, 4]
y = [10, 20, 25, 30]
error = [1, 2, 1, 3]
plt.errorbar(x, y, yerr=error, fmt='o', capsize=5)
plt.show()
收藏此条目、标记为困难题,或将其加入复习集合。
Example:
data = [np.random.normal(0, std, 100) for std in range(1, 4)]
plt.violinplot(data, showmedians=True)
plt.show()
收藏此条目、标记为困难题,或将其加入复习集合。
Example:
theta = np.linspace(0, 2*np.pi, 100)
r = 1 + np.sin(3*theta)
plt.polar(theta, r)
plt.show()
收藏此条目、标记为困难题,或将其加入复习集合。
Example:
plt.plot([1, 2, 3, 4], [10, 20, 25, 30], color='green', linestyle='--')
plt.show()
收藏此条目、标记为困难题,或将其加入复习集合。
Example:
from mpl_toolkits import mplot3d
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
ax.plot3D([1, 2, 3, 4], [10, 20, 25, 30], [5, 10, 15, 20])
plt.show()
收藏此条目、标记为困难题,或将其加入复习集合。
Example:
x = [1, 2, 3, 4]
y1 = [10, 20, 25, 30]
y2 = [5, 15, 20, 25]
plt.fill_between(x, y1, y2, color='gray', alpha=0.5)
plt.show()
收藏此条目、标记为困难题,或将其加入复习集合。
Example:
plt.subplot2grid((2, 2), (0, 0))
plt.plot([1, 2, 3, 4], [10, 20, 25, 30])
plt.show()
收藏此条目、标记为困难题,或将其加入复习集合。
Example:
plt.subplot2grid((2, 2), (0, 0))
plt.plot([1, 2, 3, 4], [10, 20, 25, 30])
plt.show()
收藏此条目、标记为困难题,或将其加入复习集合。
Example:
import numpy as np
x, y = np.meshgrid(np.linspace(-2, 2, 20), np.linspace(-2, 2, 20))
u = np.cos(x)
v = np.sin(y)
plt.streamplot(x, y, u, v)
plt.show()
收藏此条目、标记为困难题,或将其加入复习集合。
Example:
plt.subplot2grid((2, 2), (0, 0))
plt.plot([1, 2, 3, 4], [10, 20, 25, 30])
plt.show()
收藏此条目、标记为困难题,或将其加入复习集合。
Example:
plt.plot([1, 2, 3, 4], [10, 20, 25, 30])
plt.annotate('Max Value', xy=(3, 30), xytext=(2.5, 28), arrowprops=dict(facecolor='black', shrink=0.05))
plt.show()
收藏此条目、标记为困难题,或将其加入复习集合。