jacob-long / jacob-long/interactions

Change Legend Text

Open
#69 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
R
Stars
135
Forks
19
PR merge metrics
No merged PRs in 30d

Description

Hello Jacob, I have a question about changing the legend of geom_segment(). Specifically, I want to change the legend text from "Range of observed data" to something else. I used the code below, but it didn't work. Do you know other easy way to do so? I would really appreciate any ideas or suggestions you have. Thank you!

```
object <- johnson_neyman(model = fit, pred = Murder,
modx = Illiteracy)
object$plot + geom_segment(aes(x = 0.5, xend = 2.8, y = 10, yend = 10,
linetype = "range of moderate variable"),
lineend = "square", size = 1.25)
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the johnson_neyman() result and its object$plot output, then inspect how the geom_segment() layer defines the legend label. Confirm how a custom legend text can be applied to the shown plot and verify that the legend changes from "Range of observed data" without altering the plotted range.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
data-visualization
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.