【发布时间】:2019-12-25 10:51:57
【问题描述】:
我想用未填充的正方形制作散点图。 markerfacecolor 不是 scatter 识别的选项。我做了一个MarkerStyle,但散点图似乎忽略了填充样式。有没有办法在散点图中制作未填充的标记?
import matplotlib.markers as markers
import matplotlib.pyplot as plt
import numpy as np
def main():
size = [595, 842] # in pixels
dpi = 72. # dots per inch
figsize = [i / dpi for i in size]
fig = plt.figure(figsize=figsize)
ax = fig.add_axes([0,0,1,1])
x_max = 52
y_max = 90
ax.set_xlim([0, x_max+1])
ax.set_ylim([0, y_max + 1])
x = np.arange(1, x_max+1)
y = [np.arange(1, y_max+1) for i in range(x_max)]
marker = markers.MarkerStyle(marker='s', fillstyle='none')
for temp in zip(*y):
plt.scatter(x, temp, color='green', marker=marker)
plt.show()
main()
【问题讨论】:
标签: python matplotlib