Multiple lines of x tick labels in matplotlib

前端 未结 4 885
庸人自扰
庸人自扰 2020-12-06 00:05

I\'m trying to make a plot similar to this excel example:

\"example\"

I would like to know if there i

4条回答
  •  北荒
    北荒 (楼主)
    2020-12-06 00:55

    I am also unable to comment due to reputation but have a minor fix for behzad's answer.

    The tick_params() 'bottom' and 'top' keywords take booleans, not strings (at least for py3.6). For example, using bottom = 'off' for me still produces ticks whereas using bottom = False removes ticks.

    so replace

    ax.tick_params( axis='x', which='major', bottom='off', top='off' )

    with

    ax.tick_params( axis='x', which='major', bottom=False, top=False )

    and it works!

提交回复
热议问题