[R] How to show a specific value of a ggplot2

Avi Gross @v|gro@@ @end|ng |rom ver|zon@net
Fri May 27 03:45:08 CEST 2022


What exactly do you want to show Neha?

First, I am not clear on how you use plot() rather than ggplot() in your example and do not bind what x and y are in an aesthetic and more.

So I suspect you are again giving an incomplete example.

So what do you want in any case? Do you want to add say a horizontal or vertical line drawn at one or more points such as a vertical line at x=75 that intersects the graph, or a horizontal line for y at f(75) as one example.
Do you want a special dot of another color or some text near there specifying the number? Or do you want toi change the breaks on the scale of the x axis to include a "75" or make more of them closer together or ... ???

You can do many such things easily enough but unless you specify what you want, no point in answering.



-----Original Message-----
From: Neha gupta <neha.bologna90 using gmail.com>
To: r-help mailing list <r-help using r-project.org>
Sent: Thu, May 26, 2022 7:40 pm
Subject: [R] How to show a specific value of a ggplot2

I have a ggplot2 which has x-values 0-200 and y values 0-10

p=plot(mydata)
p+xlim(0, 200)

I want to show what is the y value when we have 75 as x value. The graph
which is displayed has a broad range (like 0-50, 50-100 etc on x axis) and
cannot determine the exact value of y at the value of 75 on x-axis.

Thank you

    [[alternative HTML version deleted]]

______________________________________________
R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

	[[alternative HTML version deleted]]



More information about the R-help mailing list