Matplotlib: draw lines with width given in data coordinates

后端 未结 2 2025
别跟我提以往
别跟我提以往 2021-02-09 04:36

I\'m trying to figure out how to draw lines with widths in data units. For example, in the following code snippet, I would want the horizontal part of the line of width 80 to al

2条回答
  •  野性不改
    2021-02-09 04:54

    In order to draw a line with the linewidth in data units, you may want to have a look at this answer.

    It uses a class data_linewidth_plot which closely resembles the plt.plot() command's signature.

    l = data_linewidth_plot( x, y, ax=ax, label='some line', linewidth = 1, alpha = 0.4)
    

    The linewidth argument is interpreted in (y-)data units.

提交回复
热议问题