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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T05:30:01+00:00 2026-05-29T05:30:01+00:00

This seems like a simple task or a repeat, but bear with me– I’ve

  • 0

This seems like a simple task or a repeat, but bear with me– I’ve searched for a little while and haven’t found any easy answers.

I have a scatterplot that I would like to display as a heatmap. My values look like this:

{ (3, 3): 1.7314, (3,4):-6.99, (4,3):-17.3, (4, 4):-100.0 }

I would like to display a matrix starting with cell (3,3), which has a brightness of 1.7314, etc.

I have found several questions and answers regarding situations where you give lists of two dimensional tuples (X, Y) and the Z value (the intensity) for each point (x,y,z) is created by the number of occurrences around (x, y).

I have also used imshow to draw such a plot, but for imshow you drop the (3,3), etc. So things can be shifted strangely. One option is to use imshow and then manually adjust the axis labels afterward. But I feel like someone must have solved this before without hacking pylab too much.

What is the best way to do this?

  • 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-29T05:30:02+00:00Added an answer on May 29, 2026 at 5:30 am

    Ok, let’s try an easy example using your sample data:

    import numpy as np
    from pylab import * 
    
    data = { (3, 3): 1.7314, (3,4):-6.99, (4, 3):-17.3, (4, 4):-100.0 }
    matrix = np.zeros((5, 5))
    for (x, y), z in data.items():
        matrix[y,x] = z
    
    imshow(matrix[3:, 3:], origin='lower', interpolation='none', extent=[2.5, 4.5, 2.5, 4.5])
    show()
    

    As you see, you can control the axes by specifying the limits using extent. The default (if None) would be (-0.5, numcols-0.5, -0.5, numrows-0.5) (left, right, bottom, top) if you specify you want the origin in the lower part, for the Y axis.

    Also, interpolation='none' is important for your case.

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

Sidebar

Related Questions

This seems like a really simple task, so bear with me. I'm trying to
This seems like such a simple task, but I'm having a hard time finding
This seems like a simple and common task, but we cannot get it to
This seems like it should be a simple task, but I'm a noob as
Apologies in advance. This seems like a simple task, but hours later on Google
This situation seems like it should be a simple task but I can't come
This seems like a simple task but there may be an easier way. I
This seems like a simple question, but I can't find it with the Stack
This seems like a simple question, but it is difficult to search for. I
This seems like it should be really simple, but I'm unable to figure this

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.