Partially transparent scatter plot, but with a solid color bar

后端 未结 2 1546
孤街浪徒
孤街浪徒 2020-12-13 09:02

In Python, with Matplotlib, how to simply do a scatter plot with transparency (alpha < 1), but with a color bar that represents their color value, but has alpha = 1?

2条回答
  •  长情又很酷
    2020-12-13 09:56

    Alright, I found one way to do it, that looks relatively clean: (using the ColorBar object from the question)

    color_bar.set_alpha(1)
    color_bar.draw_all()
    # pylab.draw() or pyplot.draw() might be necessary
    

    It would be great to get a confirmation that this is the most robust way to proceed, though! :)

提交回复
热议问题