Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6358269
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T23:20:15+00:00 2026-05-24T23:20:15+00:00

i create a figure with 4 subplots (2 x 2), where 3 of them

  • 0

i create a figure with 4 subplots (2 x 2), where 3 of them are of the type imshow and the other is errorbar. Each imshow plots have in addition a colorbar at the right side of them. I would like to resize my 3rd plot, that the area of the graph would be exactly under the one above it (with out colorbar)

as example (this is what i now have):

example

How could i resize the 3rd plot?

Regards

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T23:20:17+00:00Added an answer on May 24, 2026 at 11:20 pm

    To adjust the dimensions of an axes instance, you need to use the set_position() method. This applies to subplotAxes as well. To get the current position/dimensions of the axis, use the get_position() method, which returns a Bbox instance. For me, it’s conceptually easier to just interact with the position, ie [left,bottom,right,top] limits. To access this information from a Bbox, the bounds property.

    Here I apply these methods to something similar to your example above:

    import matplotlib.pyplot as plt
    import numpy as np
    
    x,y = np.random.rand(2,10)
    img = np.random.rand(10,10)
    
    fig = plt.figure()
    ax1 = fig.add_subplot(221)
    im = ax1.imshow(img,extent=[0,1,0,1])
    
    plt.colorbar(im)
    ax2 = fig.add_subplot(222)
    im = ax2.imshow(img,extent=[0,1,0,1])
    plt.colorbar(im)
    
    ax3 = fig.add_subplot(223)
    ax3.plot(x,y)
    ax3.axis([0,1,0,1])
    
    ax4 = fig.add_subplot(224)
    im = ax4.imshow(img,extent=[0,1,0,1])
    plt.colorbar(im)
    
    pos4 = ax4.get_position().bounds
    pos1 = ax1.get_position().bounds
    # set the x limits (left and right) to first axes limits
    # set the y limits (bottom and top) to the last axes limits
    newpos = [pos1[0],pos4[1],pos1[2],pos4[3]]
    
    ax3.set_position(newpos)
    
    plt.show()
    

    You may feel that the two plots do not exactly look the same (in my rendering, the left or xmin position is not quite right), so feel free to adjust the position until you get the desired effect.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am looking for a way to create figure that contains several subplots which
I create a figure and fill it with a couple of subplots. As new
I have a problem with Matplotlib 1.0.1 I create a figure, and the I
I create a figure containing two plots using a function i.e. data1<-1:3 basic<-function(data1){ par(mfrow=c(2,1))
I can't figure out how to create public / private keys for other users
I use matplotlib to create a figure with 4 sub-plots in it. I would
I have created a plot made up of four subplots; each subplot is a
I need to create a figure window with two plots at the same time.
I cannot figure out why the following simple program doesn't (create) and then write
I am trying to figure out how to create a temporary table that is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.