Question: percentage frequency distribution of two datasets on the same plot
0
4.7 years ago by
Australia

I would like to calculate the percentage frequency distribution of h1 and h2. How can I combine h1 and h2 on the same plot? The length of the vectors are different in h1 and h2. I tried the following code. it gives the plot for h1 only. your suggestions would be appreciated!!

```h1=c(5.18,4.61,3.30,7.58,3.00,3.80,1.95,2.67,2.77,2.73,2.33,3.36,3.50,1.91,4.25,3.87,2.86,2.26,2.00,3.86,3.33,3.59,4.00) h2=c(2.1,2.1,2.6,2,3.6,2,2.7,1.8,3.1,3.9,3.8,2.6,1.9,2.6,2.1,3.9,2.7,1.8,2.1,2.3,2.2,2.6,1.8,2.3,2.3,3.7,3.3,1.9,2.4,2.6,2.4,3.4,2.4,2.2,1.8,2.1,2,1.2,3.9,1.9,3.4,2,2.2,2.3,2.6,2,3,1.8,1.6,1.5,2.6,3.2,2.3) h = hist(h1) h\$percentage = h\$counts/sum(h\$counts)*100 plot(h, freq=F, xlab=```'Proteins'`, ylab='Percentage')`

R • 1.5k views
modified 4.7 years ago by Mo900 • written 4.7 years ago by ayyappadas3420
0
4.7 years ago by
Mo900
/
Mo900 wrote:

par(new=TRUE)

if you want to plot both on the same plot

@ayyappadas342 between the plots , it says hold on so that you can plot another plot on an existed one! for example plot(x,y); par(new=TRUE); plot(x,y)

in case you are calling someone , it is better you call it with a correct name so that s/he will see your comment . You should have written @Mo and not @mo . that is why I did not see your comment