plotting 3d scatter in matplotlib

前端 未结 3 1237
悲哀的现实
悲哀的现实 2021-02-07 16:13

I have a collection of Nx3 matrices in scipy/numpy and I\'d like to make a 3 dimensional scatter of it, where the X and Y axes are determined by the values of first and second c

3条回答
  •  清歌不尽
    2021-02-07 16:58

    AFAIK, legends for 3d scatter artists are not directly supported. See here: http://matplotlib.sourceforge.net/users/legend_guide.html#plotting-guide-legend

    However, you can use a hack/work-around with a 'proxy artist', using something like:

    p = Rectangle((0, 0), 1, 1, fc="r")
    axis.legend([p], ["Red Rectangle"])
    

    So the proxy artist won't be added to the axis, but you can use it to create a legend.

提交回复
热议问题