polygon() function in R Language is used to plot a polygon between specified points in an existing plot.
Syntax: polygon(x_coordinates, y_coordinates)
x_coordinates, y_coordinates: x, y coordinates of plot to draw polygon
Returns: a polygon in a given plot
Example 1: Draw a Square Polygon in an R Plot
Example 2: Color borders of polygon
Here, border specifies the border color and lwd specifies the border thickness.
Example 3: Draw frequency polygon
Example 4: Draw polygon below density
Here, above example is used to make Probability density function.
- Draw Line Segments between Particular Points in R Programming - segments() Function
- Addition of more points to a Plot in R Programming - points() Function
- Create a Range of Colors between the Specified Colors in R Programming - colorRampPalette() Function
- Draw a Quantile-Quantile Plot in R Programming - qqline() Function
- Add Color Between Two Points of Kernel Density Plot in R Programming - Using with() Function
- Plot Arrows Between Points in a Graph in R Programming - arrows() Function
- Get Indices of Specified Values of an Array in R Programming - arrayInd() Function
- Return an Object with the specified name in R Programming - get0() and mget() Function
- Extract word from a String at specified position in R Programming - word() Function
- Search and Return an Object with the specified name in R Programming - get() Function
- Create Line Curves for Specified Equations in R Programming - curve() Function
- Rounding up to the Specified Number of Significant Digits in R Programming - signif() Function
- Trim a String to a Specified Display Width in R Programming - strtrim() Function
- Check if an Object of the Specified Name is Defined or not in R Programming - exists() Function
- Generate Factors with specified Levels in R Programming - gl() Function
- Replicating a Value to the Specified Length in R Programming - rep_len() Function
- Replicating a Value specified number of times in R Programming - rep.int() Function
- Generate a Sequence from 1 to any Specified Number in R Programming - seq_len() Function
- Get a List of Numbers in the Specified Range in R Programming - seq.int() Function
- Get the Hexadecimal Code of the Specified Shade in R Programming - rgb() Function
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.