# issue with plot (type="h") Classic List Threaded 5 messages Open this post in threaded view
|

## issue with plot (type="h")

 Hello everyone. For reasons too long to explain I wanted to do plots similar to histograms with plot(type="h"). I ran into a problem - if I set line width too high, histogram isn't accurate anymore. For example: par(lend=2) plot(c(2,4,3,2),ylim=c(0,5), type="h") abline(h=3) Column 3 appears just as high as it should. But if I do par(lend=2) plot(c(2,4,3,2),ylim=c(0,5), type="h",lwd=100) abline(h=3) then columns become too high. Can I correct the problem or is there another way to display my data correctly? Thanks for help, Gašper Cankar National Examinations Centre, Slovenia ______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Open this post in threaded view
|

## Re: issue with plot (type="h")

 Gasper Cankar wrote: > Hello everyone. > > For reasons too long to explain I wanted to do plots similar to histograms with plot(type="h"). > I ran into a problem - if I set line width too high, histogram isn't accurate anymore. > > For example: > > par(lend=2) > plot(c(2,4,3,2),ylim=c(0,5), type="h") > abline(h=3) > > Column 3 appears just as high as it should. But if I do > > par(lend=2) > plot(c(2,4,3,2),ylim=c(0,5), type="h",lwd=100) > abline(h=3) > > then columns become too high. Can I correct the problem or is there another way to display my data correctly? > Try ?barplot instead: bp <- barplot(c(2, 4, 3, 2), ylim = c(0, 5)) axis(side = 1, at = bp, labels = 1:4) abline(h = 3) box() --sundar ______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Open this post in threaded view
|

## Re: issue with plot (type="h")

 In reply to this post by Gasper Cankar "Gasper Cankar" <[hidden email]> writes: > Hello everyone. > > For reasons too long to explain I wanted to do plots similar to histograms with plot(type="h"). > I ran into a problem - if I set line width too high, histogram isn't accurate anymore. > > For example: > > par(lend=2) > plot(c(2,4,3,2),ylim=c(0,5), type="h") > abline(h=3) > > Column 3 appears just as high as it should. But if I do > > par(lend=2) > plot(c(2,4,3,2),ylim=c(0,5), type="h",lwd=100) > abline(h=3) > > then columns become too high. Can I correct the problem or is there another way to display my data correctly? > > Thanks for help, lend=1 seems to cure it. --    O__  ---- Peter Dalgaard             Øster Farimagsgade 5, Entr.B   c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K  (*) \(*) -- University of Copenhagen   Denmark          Ph:  (+45) 35327918 ~~~~~~~~~~ - ([hidden email])                  FAX: (+45) 35327907 ______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide! http://www.R-project.org/posting-guide.html