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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T11:28:36+00:00 2026-06-13T11:28:36+00:00

After plotting in Matlab we do caxis(max(caxis()) – [0.5, 0]) to scale the color

  • 0

After plotting in Matlab we do caxis(max(caxis()) - [0.5, 0]) to scale the color limits to go from the current max color limit to, say, 0.5 below this max. This works because caxis() in Matlab both gets and sets the color limits. How does one do this in matplotlib?

That is, I want to achieve the following:

import numpy.random, numpy, pylab
arr = numpy.random.randn(100,100)
pylab.figure()
pylab.imshow(arr)
pylab.colorbar()
pylab.clim([numpy.max(arr.ravel())-0.5, numpy.max(arr.ravel())]) # [*]
pylab.show()

without the asterisked call to pylab.clim() having recourse to arr, the array being plotted. In other words, how can I get the current figure’s “clim” in matplotlib?

  • 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-13T11:28:38+00:00Added an answer on June 13, 2026 at 11:28 am

    If you didn’t keep the returned image object, you can use pylab.gci to get the current ScalarMappable (i.e. whatever the current colorbar would be based on).

    From there, you just want the get_clim method of the ScalarMappable object.

    So, you could do:

    vmin, vmax = plt.gci().get_clim()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My question is sort of a follow on from this question below but I
I have two curves on the zedgraph control, after plotting both the curves... PointPairList
After deploying WCF server (svc) on my Server, I have got this message when
This is a follow-up of the post at Ada: plotting 2d graphs . I
I would like to plot connected points in MATLAB. My connected points come from
I'm plotting the same data in two different formats: log scale and linear scale.
After executing this query on master db ,it is giving me all running process
I am working on a project in MATLAB. It includes continuous plotting of a
After I installed Windows 8 perfectly legit statement like this doesn't work anymore: #if
I have some MATLAB code I've been working with. There are three sections, say

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.