11.7 Low-level Plotting Functions - YaRrr! The Pirate's Guide To R
Có thể bạn quan tâm
11.7.2 points()
To add new points to an existing plot, use the points() function. The points function has many similar arguments to the plot() function, like x (for the x-coordinates), y (for the y-coordinates), and parameters like col (border color), cex (point size), and pch (symbol type). To see all of them, look at the help menu with ?points().
Let’s use points() to create a plot with different symbol types for different data. I’ll use the pirates dataset and plot the relationship between a pirate’s age and the number of tattoos he/she has. I’ll create separate points for male and female pirates:
# Create a blank plot plot(x = 1, type = "n", xlim = c(100, 225), ylim = c(30, 110), pch = 16, xlab = "Height", ylab = "Weight", main = "Adding points to a plot with points()") # Add coral2 points for male data points(x = pirates$height[pirates$sex == "male"], y = pirates$weight[pirates$sex == "male"], pch = 16, col = transparent("coral2", trans.val = .8)) # Add steelblue points for female data points(x = pirates$height[pirates$sex == "female"], y = pirates$weight[pirates$sex == "female"], pch = 16, col = transparent("steelblue3", trans.val = .8))
Figure 11.8: Using points() to add points with different colors
Từ khóa » How To Use Segments Function In R
-
Draw Line Segments Between Particular Points In R Programming
-
Segments Function - RDocumentation
-
The Segments R Function | 3 Example Codes - Statistics Globe
-
Add Line Segments To A Plot - R
-
Draw Line Segment To Plot In R (Example) - YouTube
-
Segment Function - R
-
Segments: Add Line Segments To A Plot
-
R Segments Function Examples - EndMemo
-
Abline, Segments And Arrows Functions In R - R CHARTS
-
R: Using The Segments Function To Plot A Map Of Stacked Lines
-
R: Using The Segments Function To Plot A Map Of Stacked Lines
-
Line Segments And Curves — Geom_segment • Ggplot2
-
Draw Line Segment To Plot In Base R (Example) - Data Hacks
-
Add Line Segments To A Plot - R