plot() का उपयोग
plot आपके data की एक picture draw करता है, graph paper पर dots की तरह। इसे numbers की दो lists दें और यह दिखाता है एक दूसरे से कैसे related है।
In this page:
Syntax
plot(x, y, type = "p", main = "title", xlab = "x label", ylab = "y label")
plot()
plot(x, y) R का general-purpose base plotting function है, default से दो numeric vectors से एक scatter plot draw करते हुए।
Judge0 (और दूसरे non-interactive environments) एक window display करने की बजाय plot output को एक saved image की तरह capture करते हैं। plot() इसका appearance customize करने के लिए कई arguments (type, col, pch, वगैरह) accept करता है।
Note:
- type = "l" scattered points की बजाय एक line plot draw करता है।
- type = "b" दोनों points और connecting lines draw करता है।
उदाहरण: plot()
x <- 1:10
y <- x^2
# In a graphical R environment this renders a plot window / image file.
# Here we just confirm the data plot() would use is correct:
cat("x values:", x, "\n")
cat("y values:", y, "\n")
cat("plot(x, y) would draw a scatter plot of y = x^2\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. #}
आम गलतियां
- अलग lengths के
xऔरypass करना, जोx and y lengths differजैसी एक error देता है। - एक script में
plot()चलाना औरRscriptके साथ एक window की उम्मीद करना, जब plot एक file में जाता है जिसका नामRplots.pdfहै जब तक एक device open न हो। plot()को फिर से call करना और existing plot में add होने की उम्मीद करना, जब यह एक नया शुरू करता है;points()याlines()इस्तेमाल करें।
🔒
Chapter Quiz — Complete all 7 topics to unlock
0/7 topics done
Complete these topics first: