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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T03:49:24+00:00 2026-06-18T03:49:24+00:00

I have a list of state-level data with numbers for each state, e.g.: AL

  • 0

I have a list of state-level data with numbers for each state, e.g.:

AL  10.5
AK  45.6
AZ  23.4
AR  15.0
...

and I want to make it into a weighted map, with darkest where the number is highest and lightest here it is lowest. Is there any software, or a java or python library that can generate such an image?

  • 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-18T03:49:24+00:00Added an answer on June 18, 2026 at 3:49 am

    If you want to build it yourself, all you need is a good map, a set of positions for each state in this map, and flood fill.

    Using the map http://www.clker.com/cliparts/S/r/a/w/L/0/black-and-white-u-s-map-hi.png, here is what we get:

    enter image description here

    The code to build the map above is given by

    import sys
    from PIL import Image
    
    
    def floodfill(img, seed, color):
        im = img.load()
        work = [seed]
        start_color = im[seed]
        while work:
            x, y = work.pop()
            im[x, y] = color
            for dx, dy in ((-1,0), (1,0), (0,-1), (0,1)):
                nx, ny = x + dx, y + dy
                if im[nx, ny] == start_color:
                    work.append((nx, ny))
    
    
    USA_MAP = Image.open(sys.argv[1]).convert('1')
    POINT_STATE = {'AL': (420, 260), 'AZ': (110, 240), 'AR': (350, 250)}
    
    painted_map = USA_MAP.convert('L')
    data = {'AL': 10.5, 'AZ': 23.4, 'AR': 15.0}
    # Normalize data based on the minimum weight being 0+eps and maximum 30.
    for k, v in data.items():
        v = v/30.
        color = int(round(255 * v))
        floodfill(painted_map, POINT_STATE[k], 255 - color)
    
    painted_map.save(sys.argv[2])
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a list of lists that looks like this: x[[state]][[year]] . Each element
I have a list of states, each with some data associated with it, displayed
I have list of structure. I want to modify a particular data from the
I need a city/state/country Dynamic Drop-Down List in my Wordpress registration page. I have
I have list of articles on the page in table and i want to
I have List I want to sort Desc by Priority, which is int and
i have list of rows that user select and i want to delete them,
error list Msg 4866, Level 16, State 7, Line 2 The bulk load failed.
I have a list of locations that contains a city, state, zip, latitude and
I have a bunch of data which I've plotted at the county level, without

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.