R HistogramA histogram is a type of bar chart which shows the frequency of the number of values which are compared with a set of values ranges. The histogram is used for the distribution, whereas a bar chart is used for comparing different entities. In the histogram, each bar represents the height of the number of values present in the given range. For creating a histogram, R provides hist() function, which takes a vector as an input and uses more parameters to add more functionality. There is the following syntax of hist() function: Here,
Let's see an example in which we create a simple histogram with the help of required parameters like v, main, col, etc. ExampleOutput: Let's see some more examples in which we have used different parameters of hist() function to add more functionality or to create a more attractive chart. Example: Use of xlim & ylim parameterOutput: Example: Finding return value of hist()Output: Example: Using histogram return values for labels using text()Output: Example: Histogram using non-uniform widthOutput: Next TopicR Line Graphs |