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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T02:07:32+00:00 2026-05-28T02:07:32+00:00

I have a numpy array of ints representing time periods, which I’m currently plotting

  • 0

I have a numpy array of ints representing time periods, which I’m currently plotting in a histogram to get a nice distribution graph, using the following code:

ax.hist(data,bins=100,range=(minimum,maximum),facecolor="r")

However I’m trying to modify this graph to represent the exact same data using a line instead of bars, so I can overlay more samples to the same plot and have them be clear (otherwise the bars overlap each other). What I’ve tried so far is to collate the data array into an array of tuples containing (time, count), and then plot it using

ax.plot(data[:,0],data[:,1],color="red",lw=2)

However that’s not giving me anything close, as I can’t accurately simulate the bins option of the histogram in my plot. Is there a better 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-28T02:07:33+00:00Added an answer on May 28, 2026 at 2:07 am

    You can save the output of hist and then plot it.

    import numpy as np
    import pylab as p
    
    data=np.array(np.random.rand(1000))
    y,binEdges=np.histogram(data,bins=100)
    bincenters = 0.5*(binEdges[1:]+binEdges[:-1])
    p.plot(bincenters,y,'-')
    p.show()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a 2D numpy array of shape (N,2) which is holding N points
I have a 3-dimensional numpy array. I'd like to display (in matplotlib) a nice
I have two identically-sized numpy.array objects (both one-dimensional), one of which contains a list
I have a 2D numpy array (i.e matrix) A which contains useful data interspread
I currently have a numpy multi-dimensional array (of type float) and a numpy column
I have a Numpy rec array from which I would like to do some
I have a numpy.array of 640x480 images, each of which is 630 images long.
I have a 2x2 numpy array : x = array(([[1,2],[4,5]])) which I must merge
I have a NumPy array [1,2,3,4,5,6,7,8,9,10,11,12,13,14] and want to have an array structured like
I have a numpy array with positive and negative values in. a = array([1,1,-1,-2,-3,4,5])

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.