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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T07:35:54+00:00 2026-05-31T07:35:54+00:00

I have data in a hashmap, and I want to create a histogram over

  • 0

I have data in a hashmap, and I want to create a histogram over this data using the keys as bins and the values as data.

My data:

N = {1: 12, 2: 15, 3: 8, 4: 4, 5: 1}

What I want plotted:

  |
15|    X
  |    X 
  |    X
  | X  X
  | X  X
10| X  X
  | X  X
  | X  X  X
  | X  X  X
  | X  X  X
 5| X  X  X
  | X  X  X  X
  | X  X  X  X
  | X  X  X  X
  | X  X  X  X  X
  |_________________________
    1  2  3  4  5

I’ve tried to figure out how to do this with pyplot.hist(), but all overloads I can find take a list of values, not a hashmap. Do I really have to generate this list, just to let matplotlib count all the values again?

  • 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-31T07:35:56+00:00Added an answer on May 31, 2026 at 7:35 am

    Just plot a bar graph. That’s all hist does.

    E.g.:

    import matplotlib.pyplot as plt
    
    N = {1: 12, 2: 15, 3: 8, 4: 4, 5: 1}
    plt.bar(N.keys(), N.values(), align='center')
    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

I have data stored in a HashMap, which I want to access via multiple
I have a Collection as Vector<HashMap<String, String>> Actually I am using this as list
In a PHP project I have some data I want to sort using a
I have data in this form, Article ID Company A Company B Company C
I have data that looks like this: entities id name 1 Apple 2 Orange
I have data in an MYSQL database that looks like this: Project Date Time
I have a hashmap having four values a , b , c , d
I have hashmap and its keys are like folder/1.txt,folder/2.txt,folder/3.txt and value has these text
I have an application that shows some data in p:DataTable.... This table is accessible
I have created custom result class to serialize json data to xml. I want

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.