matplotlib legend location numbers

前端 未结 1 778
盖世英雄少女心
盖世英雄少女心 2021-02-01 13:42

I am beginning to use Python for my scientific computing, and I am really liking it a lot, however I am confused by a feature of the matplotlib.pylab.legend function. In partic

1条回答
  •  有刺的猬
    2021-02-01 13:49

    The docs show this example:

    legend( ('label1', 'label2', 'label3'), loc='upper left')
    

    Presumably, you could write loc=2, but why would you? It's much more readable to use the English word.

    As to why they didn't enumerate the values to align with the numeric keypad, I presume they weren't thinking about the numeric keypad at the time.

    Edit: It's worth including here the full text of Joe Kington's comment:

    Actually, they were deliberately mimicking matlab's behavior at the time. See the "obsolete location values" section in the documentation for MATLAB's legend: mathworks.com/help/techdoc/ref/legend.html

    0 讨论(0)
提交回复
热议问题