- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to display two equal signs in R using ggplot2?
To display two equal signs using ggplot2, we can follow the below steps −
- First of all, create a data frame.
- Create a scatterplot(you can create any other plot).
- Display two equal signs using annotate function
Create the data frame
Let's create a data frame as shown below −
x<-sample(1:100,25) y<-sample(1:100,25) df<-data.frame(x,y) df
On executing, the above script generates the below output(this output will vary on your system due to randomization) −
x y 1 1 12 2 74 54 3 39 9 4 60 6 5 86 7 6 29 80 7 90 92 8 42 93 9 43 99 10 82 69 11 6 24 12 45 53 13 8 39 14 12 47 15 17 74 16 35 28 17 40 83 18 27 49 19 88 3 20 33 23 21 48 59 22 5 97 23 49 31 24 68 13 25 96 75
Create the scatterplot
Loading ggplot2 package and creating scatterplot between x and y −
x<-sample(1:100,25) y<-sample(1:100,25) df<-data.frame(x,y) library(ggplot2) ggplot(df,aes(x,y))+geom_point()
Output
Create scatterplot with two equal signs inside the plot
Use annotate function of ggplot2 package to display two equal signs inside the plot −
x<-sample(1:100,25) y<-sample(1:100,25) df<-data.frame(x,y) library(ggplot2) ggplot(df,aes(x,y))+geom_point()+annotate("text",x=75,y=75,label=(paste0("X==~Y==5 0")),parse=TRUE)
Output
- Related Articles
- How to display legend on top using ggplot2 in R?
- How to display mean in a histogram using ggplot2 in R?
- How to display 0 at Y-axis using ggplot2 in R?
- How to display fraction in a plot title using ggplot2 in R?
- How to display tilde ggplot2 graph in R?
- How to display average line for y variable using ggplot2 in R?
- How to display Y-axis with Euro sign using ggplot2 in R?
- How to display the curve on the histogram using ggplot2 in R?
- How to display negative labels below bars in barplot using ggplot2 in R?
- How to add approximately equal sign in a plot using ggplot2 in R?
- How to display positive sign for X-axis labels in R using ggplot2?
- How to display text in bar plot in the middle using ggplot2 in R?
- How to display a line in segment of a plot using ggplot2 in R?
- How to display mean line per group in facetted graph using ggplot2 in R?
- How to display mean for each group in point chart using ggplot2 in R?

Advertisements