typeerror in basic example for legend handles in matplotlib

后端 未结 3 1872
独厮守ぢ
独厮守ぢ 2021-01-19 20:23

I have difficulties to understand the legend handling. The more, the basic example from the official matplotlib legend guide

import matplotlib.pyplot as plt         


        
3条回答
  •  温柔的废话
    2021-01-19 20:40

    I was having the same issue as Jan, running Matplotlib 1.3.1 on Ubuntu 14.04. I tried the answer posted by Kobi K. His code did not raise any errors. However, the legend did not render correctly: I upgraded to Matplotlib 1.5.1, and can now render the legend correctly using the code posted by Jan, which includes the 'handles' keyword (i.e. the code that appears in the Matplotlib legend guide):

提交回复
热议问题