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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T16:40:07+00:00 2026-06-02T16:40:07+00:00

I have a data that gives the mean and SD: #info mean sd info1

  • 0

I have a data that gives the mean
and SD:

#info mean sd
info1 20.84 4.56
info2 29.18 5.41
info3 38.90 6.22

Actually there are more than 100 lines of this.
How can I plot normal distributions for each one of the line in one figure
given the above data?

  • 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-02T16:40:15+00:00Added an answer on June 2, 2026 at 4:40 pm

    Depending on how large N truly gets, you may want to split this up over a set of multiple charts. But, here’s the basic approach. First, you need to generate some random data according to your mean and sd. I chose 1000 random points, you can adjust as necessary. Next, set up a blank plot with the appropriate dimensions, then use lines and density to add the data. I used a for loop because it provided a nice way to specify the linetype for each data point. Finally, add a legend at the end:

    dat <- read.table(text = "info mean sd
    info1 20.84 4.56
    info2 29.18 5.41
    info3 38.90 6.22
    ", header = TRUE)
    
    densities <- apply(dat[, -1], 1, function(x) rnorm(n = 1000, mean = x[1], sd = x[2]))
    colnames(densities) <- dat$info
    
    plot(0, type = "n", xlim = c(min(densities), max(densities)), ylim = c(0, .2))
    for (d in 1:ncol(densities)){
      lines(density(densities[, d]), lty = d)
    }
    legend("topright", legend=colnames(densities), lty=1:ncol(densities))
    

    enter image description here

    Or, use ggplot2 which can have lots of benefits, namely it will specify reasonable xlim and ylim values for you automagically, and do sensible things with the legend without much fuss.

    library(reshape2)
    library(ggplot2)
    #Put into long format
    densities.m <- melt(densities)
    #Plot
    ggplot(densities.m, aes(value, linetype = Var2)) + geom_density()
    

    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 that looks like this: #info #info2 1:SRX004541 Submitter: UT-MGS, UT-MGS Study:
I have data that is organized in kind of a key-key format, rather than
I have some data that won't printf.... echo works, but not printf There is
I have data that I would like to compute some statistics with. The data
For an XML file I am creating I have data that contains a bullet
I have some data that I would like to visualize. Each byte of the
I have a data that looks like this . And I intend to create
I have a data that looks like this . And my code below simply
I have some data that I am displaying in 3 column format, of the
I have several data that looks like this: Vector1_elements = T,C,A Vector2_elements = C,G,A

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.