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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T16:23:17+00:00 2026-06-16T16:23:17+00:00

I just discovered pyplot.scatter and have been playing with it a bit. I’m having

  • 0

I just discovered pyplot.scatter and have been playing with it a bit. I’m having trouble interpreting my results due to the coloring. For example, given my 3 (a,b) sized data arrays dataX, dataY, and dataMag:

import pyplot as plt
import numpy as np

plt.scatter(x=dataX.flat, y=dataY.flat, vmin=np.min(dataMag),
            vmax=np.max(dataMag), c=dataMag.flat, lw=1, s=1)
plt.show()

It would be really helpful if there was a way to set the low values in dataMag (i.e. 0) to white and have the colors gradually increase to the maximum color of black, or red, or whatever i don’t care. Is there a way to do this?

Thanks in advance!

  • 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-16T16:23:18+00:00Added an answer on June 16, 2026 at 4:23 pm

    I think you are looking for the kwarg cmap.

     plt.scatter(...,cmap='hot')
    

    Taken from the scipy cookbook:

    from pylab import *
    from numpy import outer
    rc('text', usetex=False)
    a=outer(arange(0,1,0.01),ones(10))
    figure(figsize=(10,5))
    subplots_adjust(top=0.8,bottom=0.05,left=0.01,right=0.99)
    maps=[m for m in cm.datad if not m.endswith("_r") ]
    maps.sort()
    l=len(maps)+1
    for i, m in enumerate(maps):
        subplot(1,l,i+1)
        axis("off")
        imshow(a,aspect='auto',cmap=get_cmap(m),origin="lower")
        title(m,rotation=90,fontsize=10)
    

    well generate a figure with all the color maps available with your installation. The name with ‘_r’ appeded on the end will give you the same map, with the colors in the opposite direction.

    It is also possible to define your own custom color maps

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

Sidebar

Related Questions

I just discovered the what c# knowledge should I have? question and wondered about
I just discovered that the Delphi TRibbonComboBox doesn't have an item index, and it
I have just discovered a nasty memory leak using both each_array() and each_arrayref() from
I have just discovered that my app doesn't run in 4.3 even though the
I have just discovered C-x C-a C-j (jump to cursor) when running gdb in
Just discovered this incredible library, but am a bit overwhelmed with all the options.
I just discovered ShareKit , and it looks great. I have one doubt, though:
I just discovered something that I found odd. I have mys listbox with several
I just discovered strange behaviour of Firefox. If I have a table cell of
I've just discovered Sass, and I've been so excited about it. In my website

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.