Adjust one subnet height in an absolute way (not relative) in Matplotlib

I would like to have two subheadings in Matplotlib (built-in to the GUI):

  • Subplot 1: The height is fixed at a certain number of pixels.
  • Subheading 2: Height occupies the rest of the entire height of the shape (including margins).

In both cases they have the same width.

GridSpec does not seem to allow absolute size, only relative size. I do not want Subplot 1 to stretch its height with window resizing.

How can i do this?

+5
source share
1 answer

, . , .

    import pylab as pl
    # use pylab.Axes(figure, [left, bottom, width, height]) 
    # where each value in the frame is between 0 and 1

    #top
    figure = pl.figure()
    axes = pl.Axes(figure, [.4,.4,.25,.25])
    figure.add_axes(axes) 
    pl.plot([1, 2, 3], [1, 2, 3])

    #bottom
    axes = pl.Axes(figure, [.4,.1,.25,.25])
    figure.add_axes(axes) 
    pl.plot([1, 2, 3], [1, 2, 3])

    pl.show()

, , , .

+1

All Articles