Question: percentage frequency distribution of two datasets on the same plot
gravatar for ayyappadas342
4.0 years ago by
ayyappadas3420 wrote:

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!!

h = hist(h1)
h$percentage = h$counts/sum(h$counts)*100
plot(h, freq=F, xlab=
'Proteins', ylab='Percentage')

R • 1.3k views
ADD COMMENTlink modified 4.0 years ago by Mo880 • written 4.0 years ago by ayyappadas3420
gravatar for Mo
4.0 years ago by
Mo880 wrote:

@ayyappadas342 you can use 


if you want to plot both on the same plot


ADD COMMENTlink modified 4.0 years ago • written 4.0 years ago by Mo880

@mo Thank you for your answer.Where do I have to add par(new=TRUE)

ADD REPLYlink written 4.0 years ago by ayyappadas3420

@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 

ADD REPLYlink modified 4.0 years ago • written 4.0 years ago by Mo880
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1929 users visited in the last hour