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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T17:32:19+00:00 2026-06-17T17:32:19+00:00

I need a histogram for my data, but could not find one with a

  • 0

I need a histogram for my data, but could not find one with a curve. Can anyone please suggest a histogram showing frequencies (not densitities) with a curve for the data below? Fancy ones are preferred, but no worries if not 🙂

x <- rnorm(1000)
hist(x)
  • 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-17T17:32:21+00:00Added an answer on June 17, 2026 at 5:32 pm

    Here’s the slow, step-by-step version.

    This is your data.

    population_mean <- 0
    population_sd <- 1
    n <- 1000
    x <- rnorm(n, population_mean, population_sd)
    

    These are some x coordinates for drawing a curve. Notice the use of qnorm to get lower and upper quantiles from a normal distribution.

    population_x <- seq(
      qnorm(0.001, population_mean, population_sd), 
      qnorm(0.999, population_mean, population_sd), 
      length.out = 1000
    )
    

    In order to convert from density to counts, we need to know the binwidth. This is easiest if we specify it ourselves.

    binwidth <- 0.5
    breaks <- seq(floor(min(x)), ceiling(max(x)), binwidth)
    

    Here’s our histogram.

    hist(x, breaks)
    

    The count curve is the normal density times the number of data points divided by the binwidth.

    lines(
      population_x, 
      n * dnorm(population_x, population_mean, population_sd) * binwidth, 
      col = "red"
    )
    

    Let’s see that again with the sample distribution rather than the population distribution.

    sample_mean <- mean(x)
    sample_sd <- sd(x)
    sample_x <- seq(
      qnorm(0.001, sample_mean, sample_sd), 
      qnorm(0.999, sample_mean, sample_sd), 
      length.out = 1000
    )
    lines(
      population_x, 
      n * dnorm(sample_x, sample_mean, sample_sd) * binwidth, 
      col = "blue"
    )
    

    histogram with frequency curves

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

Sidebar

Related Questions

I had load buffered image and need to plot histogram? please suggest me next
Could anyone share their code for calculating the PGH (Pairwise Geometric Histogram) similarity ?
Here is my problem: How can I find the index of the histogram bin
I need to generate bins for the purposes of calculating a histogram. Language is
Need help getting Ember-Data working with Zend Rest. At first, I'm familiar with Zend
Need your guidance, I am writing one app in android with the help of
I am working in an app in which I need to draw Histogram of
I am drawing a histogram using an array of data (counts) and an array
I need to write and algorithm that can detect which state an application (used
I don't do much coding outside of Matlab, but I have a need to

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.