barplot() का उपयोग
एक bar plot प्रति category एक bar draw करता है, बड़ी values के लिए लंबे bars, आपके friends की heights compare करने की तरह। यह counts compare करना आसान बनाता है।
In this page:
Syntax
barplot(heights, names.arg = labels, main = "title")
barplot()
barplot(heights) values के एक vector से (या एक table() result से) एक bar chart draw करता है, प्रति value एक bar, categorical counts या totals compare करने के लिए useful।
names.arg हर bar label करता है। यह categorical/count data visualize करने का standard तरीका है, hist() के उलट जो continuous numeric distributions के लिए है।
Note:
barplot(table(x)) एक common combo है: एक categorical vector tabulate करें, फिर सीधे counts chart करें।
उदाहरण: barplot()
sales <- c(Jan = 100, Feb = 150, Mar = 120)
print(sales)
cat("barplot(sales) would draw one bar per month with these heights\n")
Login to try C/C++/Java/PHP code in the editor
Related Topics
{# common_mistakes/chapter_summary/browser_support: on Hindi pages the
view already swaps in the hi_ translation fields (or blanks these
out if untranslated), so this renders correctly for both languages
without a lang_code check here. #}
आम गलतियां
c("a", "b", "a")जैसा raw data pass करना और एक error पाना, जब counts के लिए आपकोbarplot(table(x))चाहिए।names.argभूल जाना जब vector के कोई names न हों, इसलिए bars unlabeled रहते हैं।barplot()कोhist()से confuse करना, जब barplot प्रति category एक bar दिखाता है।
🔒
Chapter Quiz — Complete all 7 topics to unlock
0/7 topics done
Complete these topics first: