ggplot2: Displaying equation of the line on the plot

65 views
Skip to first unread message

Liberty Mgbanyi

unread,
Oct 2, 2017, 7:42:18 AM10/2/17
to ggplot2
In Excel I can just click a button an include the equation of the line. please how can I display line equation on the plot in ggplot2?

Pete St Marie

unread,
Oct 2, 2017, 11:09:06 AM10/2/17
to ggplot2
Hi,

You might start here:

Or if you have a faceted plot:

BTW, just typing what you're looking for into google can be a good place to start. For me, the above were the first 2 returns for a google search of your post title.

--pete 

Pedro Aphalo

unread,
Oct 2, 2017, 11:44:24 AM10/2/17
to ggplot2
Hi,

You might want to try package ggpmisc. Have a look at the vignette for examples.
(I am biased, I am the author, but I think it provides the easiest way for displaying an equation in a ggplot).

Pedro.

Pete St Marie

unread,
Oct 3, 2017, 9:50:26 AM10/3/17
to ggplot2
Hi Pedro,

I totally forgot about ggpmisc!
It's now in my list of R-packages-to-check-first.
Thank you for your work.

--peter
Reply all
Reply to author
Forward
0 new messages