Description Usage Arguments Details Value Note Author(s) See Also Examples

Draw a histogram with bars horizontally

1 2 3 4 5 |

`Data` |
any data that |

`breaks` |
character or numerical as explained in |

`freq` |
logical. if TRUE, the histogram graphic is a representation of frequencies, the counts component of the result; if FALSE, probability densities, component density, are plotted (so that the histogram has a total area of one). DEFAULT: TRUE |

`plot` |
logical. Should histogram be plotted? FALSE to get just the hpos function. DEFAULT: TRUE |

`col` |
color. DEFAULT: par("bg") |

`border` |
color of borders of bars. DEFAULT: par("fg") |

`las` |
integer. Label axis style. DEFAULT: 1 |

`xlab` |
character. Label for x-axis. DEFAULT: "absolute frequency" |

`main` |
character. Title for graphic. DEFAULT: "Histogram of substitute(Data)" |

`ylim` |
numerical vector of two elements. Y-axis limits. DEFAULT: range of data |

`labelat` |
numerical vector. Position of Y-Axis labels. DEFAULT: pretty(ylim) |

`labels` |
numerical or character. The labels themselves. DEFAULT: labelat |

`...` |
further arguments passed to |

Uses barplot to draw the histogram horizontally.

function to address y-coordinates

Doesn't work with breakpoints provided as a vector with different widths of the bars.

Please do not forget to use the function for vertical positioning from the **current** horizontal histogram.
If It is not working correctly, you might have the function defined from some prior horizHist result.

Berry Boessenkool, [email protected], 2011-2012

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | ```
# Data and basic concept
set.seed(8); ExampleData <- rnorm(50,8,5)+5
hist(ExampleData)
hpos <- horizHist(ExampleData)
# Caution: the labels at the y-axis are not the real coordinates!
# abline(h=2) will draw above the second bar, not at the label value 2.
# Use hpos (horizontal position), the function returned by horizHist:
abline(h=hpos(11), col=2, lwd=2)
# Further arguments
horizHist(ExampleData, xlim=c(-8,20))
horizHist(ExampleData, ylab="the ... argument worked!", col.axis=3)
hist(ExampleData, xlim=c(-10,40)) # with xlim
horizHist(ExampleData, ylim=c(-10,40), border="red") # with ylim
hpos <- horizHist(ExampleData, breaks=20, col="orange")
axis(2, hpos(0:10), labels=FALSE, col=2) # another use of hpos()
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.