matplotlib标记中的多种颜色填充

时间:2016-12-15 15:03:21

标签: matplotlib colors marker

我想在matplotlib制作的标记中使用多种颜色。在this example之后,使用this documentation中的一些其他信息,做两种颜色并不困难。但是,我想知道是否可以制作超过2种颜色的标记。我希望单个标记能够实际获得3种不同的颜色(地图上的某个点指的是三种不同的颜色)。

1 个答案:

答案 0 :(得分:1)

您可以按照此处显示的matplotlib示例执行此操作:

matplotlib.org/examples/api/scatter_piecharts.html

下面我稍微更改了示例,使用ax.plot代替ax.scatter

基本上这意味着您的所有标记必须具有相同的尺寸,而不是使用s的{​​{1}} kwarg,而是使用scatter(或ms)kwarg markersize

此外,您需要定义plot而不是facecolor

除了这些更改之外,其他所有内容都与原始示例保持一致。

markerfacecolor

enter image description here