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

  • Home
  • SEARCH
  • 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 8359869
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T11:17:23+00:00 2026-06-09T11:17:23+00:00

I have two figures with 3 subplots in each of them. In each subplot,

  • 0

I have two figures with 3 subplots in each of them. In each subplot, there are 20 different curves, which represents 20 steps, by using a for loop. How can I make the color of the curves gradually fade? Like in the code I have below, the top subplot (311) has 20 blue curves…how can I make the 1st step be dark blue and have the blue gradually fade until the last step be a light blue? Also, how do I make the two figures pop up on screen at once? Right now, I have to manually close the first figure in order for the second figure to pop up.

from pylab import *
for raw_step in raw:
    raw_step = zip(*raw_step)
    Raw_Vertex, Raw_KI, Raw_KII, Raw_KIII = raw_step[0], raw_step[1], raw_step[2], raw_step[3]

    subplot(311)
    plot(Raw_Vertex, Raw_KI, 'bo-')
    grid(True)
    title('Raw SIFs')
    ylabel('K_I')

    subplot(312)
    plot(Raw_Vertex, Raw_KII, 'go-')
    grid(True)
    ylabel('K_II')

    subplot(313)
    plot(Raw_Vertex, Raw_KIII, 'ro-')
    grid(True)
    xlabel('Vertex')
    ylabel('K_III')

show()


for mls_step in mls:
    mls_step = zip(*mls_step)
    MLS_Vertex, MLS_KI, MLS_KII, MLS_KIII = mls_step[0], mls_step[1], mls_step[2], mls_step[3]

    subplot(311)
    plot(MLS_Vertex, MLS_KI, 'bo-')
    grid(True)
    title('MLS SIFs')
    ylabel('K_I')

    subplot(312)
    plot(MLS_Vertex, MLS_KII, 'go-')
    grid(True)
    ylabel('K_II')

    subplot(313)
    plot(MLS_Vertex, MLS_KIII, 'ro-')
    grid(True)
    xlabel('Vertex')
    ylabel('K_III')

show()
  • 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-06-09T11:17:25+00:00Added an answer on June 9, 2026 at 11:17 am

    To get lightening shades of blue, use

    blues = plt.get_cmap('Blues')  # this returns a colormap
    color = blues(1 - float(i)/(len(raw)-1)) # blues(x) returns a color for each x between 0.0 and 1.0
    

    To place the subplots side-by-side, use fig.add_subplots(row, columns, n) to define the 6 axes.

    fig = plt.figure()
    ax[1] = fig.add_subplot(3, 2, 1) # 3x2 grid, 1st plot
    ...
    ax[6] = fig.add_subplot(3, 2, 6) # 3x2 grid, 6th plot
    

    import matplotlib.pyplot as plt
    import numpy as np
    
    raw = range(20)
    mls = range(20)
    ax = {}
    blues = plt.get_cmap('Blues')
    reds = plt.get_cmap('Reds')
    greens = plt.get_cmap('Greens')
    
    fig = plt.figure()
    
    ax[1] = fig.add_subplot(3, 2, 1)
    ax[1].set_title('Raw SIFs')
    ax[1].grid(True)
    ax[1].set_ylabel('K_I')
    
    ax[3] = fig.add_subplot(3, 2, 3)
    ax[3].grid(True)
    ax[3].set_ylabel('K_II')
    
    ax[5] = fig.add_subplot(3, 2, 5)
    ax[5].grid(True)
    ax[5].set_xlabel('Vertex')
    ax[5].set_ylabel('K_III')
    
    ax[2] = fig.add_subplot(3, 2, 2)
    ax[2].set_title('MLS SIFs')
    ax[2].grid(True)
    ax[2].set_ylabel('K_I')
    
    ax[4] = fig.add_subplot(3, 2, 4)
    ax[4].grid(True)
    ax[4].set_ylabel('K_II')
    
    ax[6] = fig.add_subplot(3, 2, 6)
    ax[6].grid(True)
    ax[6].set_xlabel('Vertex')
    ax[6].set_ylabel('K_III')
    
    for i, raw_step in enumerate(raw):
        Raw_Vertex = np.arange(10)
        Raw_KI = Raw_Vertex*(i+1)
        Raw_KII = Raw_Vertex*(i+1)
        Raw_KIII = Raw_Vertex*(i+1)
        ax[1].plot(Raw_Vertex, Raw_KI, 'o-', color = blues(1 - float(i)/(len(raw)-1)))
        ax[3].plot(Raw_Vertex, Raw_KII, 'o-', color = greens(1 - float(i)/(len(raw)-1)))
        ax[5].plot(Raw_Vertex, Raw_KIII, 'o-', color = reds(1 - float(i)/(len(raw)-1)))
    
    for i, mls_step in enumerate(mls):
        MLS_Vertex = np.arange(10)
        MLS_KI = MLS_Vertex**2*(i+1)
        MLS_KII = MLS_Vertex**2*(i+1)
        MLS_KIII = Raw_Vertex**2*(i+1)
    
        ax[2].plot(MLS_Vertex, MLS_KI, 'o-', color = blues(1 - float(i)/(len(mls)-1)))
        ax[4].plot(MLS_Vertex, MLS_KII, 'o-', color = greens(1 - float(i)/(len(mls)-1)))
        ax[6].plot(MLS_Vertex, MLS_KIII, 'o-', color = reds(1 - float(i)/(len(mls)-1)))
    
    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

For example, I have set of geometrical figures: Set<Figure> figures; There are two types
Say that I have two figures in matplotlib, with one plot per figure: import
I have two divs which should looks like one figure. The problem is with
I have two graphs with in one image, each with 5 points. Their value
Problem is like this: I have two winapi application's. There is only one way
I have two figures, one is a data plot resulting from some calculations and
I am using JQuery to calculate some totals figures and I have run into
I have two buttons which call the same function. That functions signature is -
I have a plot with two y-axes, using twinx() . I also give labels
I have two custom methods for a model manager in Django. One of them

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.