आपकी ऑफलाइन सहायता

BACK
49

सी प्रोग्रामिंग

149

पाइथन प्रोग्रामिंग

49

सी प्लस प्लस

99

जावा प्रोग्रामिंग

149

जावास्क्रिप्ट

49

एंगुलर जे.एस.

69

पी.एच.पी.
माय एस.क्यू.एल.

99

एस.क्यू.एल.

Free

एच.टी.एम.एल.

99

सी.एस.एस.

149

आर प्रोग्रामिंग

39

जे.एस.पी.





डाउनलोड पी.डी.एफ. ई-बुक्स
R - R Histograms

Histogram ये दो values के बीच का वर्णन करता है | ये bar plot से काफी मिलता-जुलता है लेकिन histogram ये लगातार आने वाले values का समूह करता है | Histogram में दो values के range में आनेवाले सभी values को अपनी ऊंचाई से वर्णन करता है |

R में Histograms को create करने के लिए 'hist()' function का इस्तेमाल किया जाता है |

Syntax for hist() Function in R

hist(x,main,xlab,ylab,breaks,xlim,ylim,col,border,freq)

Parameters for hist() Function in R

x : vector. यहाँ पर numeric vector दिया जाता है |

main : string. histogram chart को title दिया जाता है | default main 'Histogram of variable_name' होता है |

xlab : string. x-axis को label दिया जाता है | default xlab 'vector'या उसका variable_name होता है |

ylab : string. y-axis को label दिया जाता है | default ylab 'Frequency' होता है |

breaks : numeric or vector. हर bar के width को दिया जाता है |

xlim : vector. x-axis की limit को दिया जाता है |

ylim : vector. y-axis की limit को दिया जाता है |

col : string or vector. हर bar को color दिया जाता है |

border : string. bars के border का color दिया जाता है |


Simple Example for histogram in R

Example पर simple hist() function से histogram chart को create किया गया है |

Source Code :
vector = c(25,10,15,35,45,74,87,12,101)
hist(vector)



Add Custom Title, x label and y label on histogram in R

Example पर title, x label और y label को set किया गया है |

Source Code :
vector = c(25,10,15,35,45,74,87,12,101)
hist(vector, main = 'My First Histogram', xlab = 'X-axis', ylab = 'Y-axis')



Add colors on histogram in R

Example पर histogram के bars को तीन colors से color किया गया है |

Source Code :
vector = c(25,10,15,35,45,74,87,12,101)
colors = c('red','green','blue')
hist(vector, main = 'My First Histogram', 
xlab = 'X-axis', ylab = 'Y-axis', col = colors)



Example for hist() function with breaks parameter in R

Example पर breaks इस parameter की मदद से bar की width को increase किया गया है |

Source Code :
vector = c(25,10,15,35,45,74,87,12,101)
colors = c('red','green','blue')
hist(vector, main = 'My First Histogram', xlab = 'X-axis', ylab = 'Y-axis', col = colors, breaks = 2)