Draw separator or lines between subheadings

I have four subplots in one figure and they share xaxis with each other.

However, there is no separator between these subnets. I want to draw a line between each one. or is there any delimiter in these subplots?

At the very least, there should be a separator between the axis of the subheadings. I think it should look like below.

\ ------------------------------------

  subplot1

      

\ ------------------------------------

  subplot2

      

\ ------------------------------------

  ...

      

\ ------------------------------------

+3


source to share


1 answer


I find a solution, but not perfect, but works for me.

Apply below code to each subheading object.

Where [-1, 1.5] are values ​​to cover all areas of the X-axis in the figure. not all the same.

axes.plot([-1, 1.5], [0, 0], color='black', lw=1, transform=axes.transAxes, clip_on=False)
axes.plot([-1, 1.5], [1, 1], color='black', lw=1, transform=axes.transAxes, clip_on=False)

      



I tried another way, which in my opinion is the most perfect way. As shown below in code.

    trans = blended_transform_factory(self.figure.transFigure, axes.transAxes)
    line = Line2D([0, 1], [0, 0], color='w', transform=trans)
    self.figure.lines.append(line)

      

In the above code, the line will start at the beginning of each edge of the shape, and it will change when the shape is resized.

+3


source







All Articles