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

  • Home
  • SEARCH
  • 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 8132271
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T09:18:28+00:00 2026-06-06T09:18:28+00:00

Possible Duplicate: How to plot two histograms together in R? I want to plot

  • 0

Possible Duplicate:
How to plot two histograms together in R?

I want to plot two histograms together, both of them having same x axis units and y axis units. Two histograms are taken from two files, inp1 and inp2. I have tried the following code but it is not working:

x1<-hist(inp1, 120, plot = 0)  
x2<-hist(inp2, 120, plot = 0)  
hist(x1, x2, 240, plot = 1)
  • 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-06T09:18:30+00:00Added an answer on June 6, 2026 at 9:18 am

    The kind of plot you want is not strictly speaking a histogram. You can create something like it, though, using barplot() with beside=TRUE:

    ## Example data
    d1 <- rnorm(1000)
    d2 <- rnorm(1000, mean=1)
    
    ## Prepare data for input to barplot
    breaks <- pretty(range(c(d1, d2)), n=20)
    D1 <- hist(d1, breaks=breaks, plot=FALSE)$counts
    D2 <- hist(d2, breaks=breaks, plot=FALSE)$counts
    dat <- rbind(D1, D2)
    colnames(dat) <- paste(breaks[-length(breaks)], breaks[-1], sep="-")
    
    ## Plot it
    barplot(dat, beside=TRUE, space=c(0, 0.1), las=2)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: core-plot remove decimal points from axis labels I 'am building a Scatterplot
Possible Duplicate: Shading a kernel density plot between two points I want to produce
Possible Duplicate: Plot dates on the x axis and time on the y axis
Possible Duplicate: How to choose the numbers shown on the axes of a plot
Possible Duplicate: thread with multiple parameters How does one thread a sub with two
Possible Duplicate: How to call a JavaScript function from PHP? I have a php
Possible Duplicate: Equation-driven smoothly shaded concentric shapes How could I plot a symmetrical heart
Possible Duplicate: Extracting dollar amounts from existing sql data? I have a column in
Possible Duplicate: matlab - variable in plot title I would like to quote the
Possible Duplicate: Plotting 4 curves in a single plot, with 3 y-axes assuming I

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.