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

Labels और Titles जोड़ना

Labels और titles readers को बताते हैं एक plot किस बारे में है, एक caption लिखने और axes को नाम देने की तरह। R आपको एक main title और हर side पर words add करने देता है।
Syntax
r
plot(x, y, main = "title", xlab = "x label", ylab = "y label", col = "color")

Labels और Titles Add करना

Plot functions एक title के लिए main, axis labels के लिए xlab/ylab, और color के लिए col accept करते हैं, सब सीधे arguments की तरह।

Clear labeling एक raw plot को ऐसी चीज़ में बदल देता है जिसे एक reader actually बिना guess किए interpret कर सकता है कि axes क्या represent करते हैं। Well-labeled plots किसी भी share या publish होने वाले chart के लिए एक basic requirement हैं।

Note: हमेशा main, xlab, और ylab set करें -- एक unlabeled plot इसे बनाने वाले person के अलावा किसी के लिए लगभग useless है।

उदाहरण: Adding Labels and Titles

markup
x <- 1:5
y <- c(2, 4, 6, 8, 10)

cat("plot(x, y, main='Growth', xlab='Time', ylab='Value', col='blue')\n")
cat("would draw a labeled scatter plot titled 'Growth'\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. बिना quotes के xlab = Time लिखना, जब labels strings होनी चाहिए।
  2. col = "blue" की बजाय color = "blue" इस्तेमाल करना, जो ignore होता है या error देता है।
  3. plot() से पहले title() add करना, जब यह एक plot exist होने के बाद ही आना चाहिए।
चैप्टर सारांश
  • plot(), hist(), barplot(), boxplot(), और pie() अलग-अलग chart types बनाते हैं।
  • par() settings control करती हैं कि graphics कैसे arrange और draw होते हैं।
  • Labels और titles charts clear बनाते हैं।
🔒

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.