← Back to R Course | Chapter 10: Data Visualization | Lesson 5 of 7

pie() का उपयोग

एक pie chart slices में काटा गया एक circle है, जहाँ एक बड़ा slice एक बड़ा share मतलब है। यह एक pizza split करके दिखाने जैसा है किसको कितना मिला।

In this page:

  1. pie()
Syntax
r
pie(values, labels = labels, main = "title")

pie()

pie(values) values के एक vector से एक pie chart draw करता है, हर एक को पूरे का एक proportional slice दिखाते हुए।

Pie charts sparingly और सिर्फ categories की एक छोटी संख्या के लिए best इस्तेमाल होते हैं, क्योंकि viewers के लिए slice angles compare करना bar heights compare करने से harder है। labels हर slice के बगल दिखाया text set करता है।

Note: एक मुट्ठी भर categories से ज़्यादा के लिए, pie() से barplot() prefer करें -- proportions bar heights की तरह compare करना कहीं आसान है।

उदाहरण: pie()

markup
shares <- c(Product_A = 40, Product_B = 35, Product_C = 25)

print(shares)
cat("pie(shares) would draw a pie chart with these three proportional slices\n")
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. #}
आम गलतियां
  1. कई slices या similar values वाला एक pie chart इस्तेमाल करना, जो पढ़ना मुश्किल है और एक bar chart clearer है।
  2. 100 तक add न होने वाली percentages pass करना और एक full circle की उम्मीद करना, जब pie() फिर भी total तक scale करता है।
  3. labels भूल जाना जब vector के कोई names न हों, इसलिए slices labeled नहीं हैं।
🔒

Chapter Quiz — Complete all 7 topics to unlock

0/7 topics done

Complete these topics first:

Login to run this code

C/C++/Java/PHP execution requires a free account. Your code is saved — you'll land right back in the editor after logging in.