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 6228329
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T09:22:12+00:00 2026-05-24T09:22:12+00:00

I have a subplot of 28 lines x 2 columns(it can change, actually). The

  • 0

I have a subplot of 28 lines x 2 columns(it can change, actually). The yaxis scale of all the lines of the 1st column is supposed to be the same (that must work for that 2nd column as well)….

All the xaxis are supposed to be the same.

What I want to do is to make something inside the output figure that shows what is the yaxis for the 1st and 2nd columns and what is the xaxis for both columns… I also want to get a label to up top at the 1st and 2nd column (saying what are those data).

I also want to change the aspect of the plots so that it can be seen more clearly (probably increasing the yaxis aspect size and drecreasing the xaxis size a little).

The subplot I want, without the re-sizing, should be something like this:

Output Figure

It can be something different. I really don’t know whats possible to make out of my request.

The code i usd to generate the figure (without the paint-made labels):

def pltconc(conc,self):
t=self.t
idx1=0
conc=conc*1000000


c=len(find( self.ml[:,3]==1 ))

from scipy.stats import scoreatpercentile #To adjust the scales
ymin1 = max([median(scoreatpercentile(conc[:,i,:],0.05)) for i in range(28)])
ymax1 = max([median(scoreatpercentile(conc[:,i,:],99.95)) for i in range(28)])

for idx1 in range(c):
    a=subplot(c,2,2*idx1+1, adjustable='box-forced')
    plt.plot(t,conc[:,idx1,0],color='r')
    plt.plot(t,conc[:,idx1,1],color='b')
    plt.axis('tight')
    xlim(0,max(self.t))
    ylim(ymin1,ymax1)
    frame1 = plt.gca()
    a.set_yticklabels([])
    a.set_xticklabels([])


    ax=subplot(c,2,2*idx1+2, adjustable='box-forced')
    CBV = (conc[:,idx1,2]*100)/(90+conc[:,idx1,2])
    StO2 = (conc[:,idx1,0]*100)/(90+conc[:,idx1,2])
    ymin2 = max(median(scoreatpercentile(CBV,0.05)),median(scoreatpercentile(StO2,0.05)))
    ymax2 = max(median(scoreatpercentile(StO2,99.95)),median(scoreatpercentile(CBV,99.95)))
    plt.plot(t,CBV, color='m')
    plt.plot(t,StO2, color = 'b')
    plt.axis('tight')
    xlim(0,max(self.t))
    ylim(ymin2,ymax2)
    frame1 = plt.gca()
    ax.set_yticklabels([])
    ax.set_xticklabels([])

Thanks alot for the help.

I changed the code since I’ve realized they weren’t correctly scaled. The output figure should be a little bit differente, but it doesn’t really matters for this questions purpose.

  • 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-24T09:22:13+00:00Added an answer on May 24, 2026 at 9:22 am

    I’m not entirely sure what you’re asking, but here’s how I’d go about plotting something along those lines…

    The aspect ratio for your figure is controlled by the figsize kwarg to plt.figure (or plt.subplots, in this case).

    The rest you can do with judicious application of annotate.

    Here’s an example:

    import matplotlib.pyplot as plt
    import numpy as np
    
    # Generate the data
    data = (np.random.random((20, 2, 2, 1001)) - 0.5).cumsum(axis=-1)
    
    # Set up the figure (the figsize is what's going to control your aspect ratio)
    fig, axes = plt.subplots(nrows=20, ncols=2, sharex=True, figsize=(6, 10))
    fig.subplots_adjust(wspace=0.1, hspace=0, bottom=0.05)
    
    # Turn off tick labels everywhere
    for ax in axes.flat:
        for axis in [ax.xaxis, ax.yaxis]:
            axis.set_ticklabels([])
    
    # Plot the data
    color = {(0,0):'red', (0,1):'green', (1,0):'blue', (1,1):'magenta'}
    for (i,j), ax in np.ndenumerate(axes):
        for k in range(2):
            ax.plot(data[i,j,k,:], color=color[(j,k)])
    
    # Add stacked titles (and text legends)
    titles = [['TITLE:', 'Red: Data X', 'Green: Data Y'],
              ['TITLE:', 'Blue: Data W', 'Magenta: Data Z']]
    for i, title in enumerate(titles):
        for text, ypos in zip(title, [35, 20, 5]):
            axes[0,i].annotate(text, xy=(0.05, 1.0), xytext=(0, ypos), va='bottom',
                               xycoords='axes fraction', textcoords='offset points')
    
    # Add arrows on "super-Y" axes
    xpos, length = -0.1, 5
    axes[12,0].annotate('', xy=(xpos, 0), xytext=(xpos, length), 
            xycoords='axes fraction', textcoords='axes fraction',
            arrowprops=dict(arrowstyle='<|-'))
    axes[12,0].annotate('{0} subplots'.format(length), xy=(xpos, length/2.0), 
            xycoords='axes fraction', rotation=90, va='center', ha='right')
    
    # Add arrows on "super-X" axes
    ypos, length = -0.7, 1000
    axes[-1,0].annotate('', xy=(0, ypos), xytext=(length, ypos),
            xycoords=('data', 'axes fraction'), textcoords=('data', 'axes fraction'),
            arrowprops=dict(arrowstyle='<|-'))
    axes[-1,0].annotate('{0} data units'.format(length), xy=(length/2.0, ypos), 
            xytext=(0, 5), xycoords=('data', 'axes fraction'), 
            textcoords='offset points', ha='center', va='bottom')
    
    plt.show()
    

    enter image description here

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

Sidebar

Related Questions

I have multiple lines to be drawn on the same axes, and each of
Have a SomeLib.pro file that contains: CONFIG += debug TEMPLATE = lib TARGET =
Have a matrix report now that has Position, Hours and Wages for a location
I have the following String that I need to parse. I am looking for
I have the following script to ultimately plot a 4 by 2 subplot: files
if I have a series of subplots with one column and many rows, i.e.:
Based on the above subplot: 1) I want to be able to have one
I have a matplotlib figure that I want to be able to switch between
I have this program, which as you can see is pulling random pictures out
I am trying to make a matplotlib figure that will have multiple horizontal boxplots

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.