0

I am interested in creating a plot where only part of the spine is visible (say only for positive values), while the plot is shown for both negative and positive values.

set_position  # seems to only set the point where it intersects with the other axis

set_visible   # is an on-off switch. It does not allow for partial visibility.

Is there a way to do this?

Mike
  • 3,775
  • 8
  • 39
  • 79

1 Answers1

2

With ax as the axes, if the x-axis is to show only between 0 and 0.5, then:

ax.spines['bottom'].set_bounds((0, 0.5))

You might need to set the ticks, as well, so, for instance:

ax.set_xticks([0, 0.25, 0.5])
fdireito
  • 1,709
  • 1
  • 13
  • 19