Skip to main content

All Questions

Tagged with
-1 votes
1 answer
40 views

Add horizontal lines with according color and legend to ggplot using R

I want to add horizontal lines so that the lines have y-intercept of period and colors according to their obj_name, ie the same colors as the line plot for each object. I succeeded in putting in these ...
Jason Liu's user avatar
1 vote
1 answer
25 views

Avoid vlines groups to appear in legend

I want to make a line plot with custom colors and additional vlines with custom colors too. It all works well except I cannot find a way of removing the vline groups from the legend... after checking ...
DaniCee's user avatar
  • 2,859
1 vote
1 answer
180 views

Force ggplot2 to show legends (barchar and geom_line)

Easy question: I'm creating a barchart in ggplot2 with both a stacked barchart and a geom_line referring to different parts of the same dataset. No matter what I do, I'm unable to show the legends (...
Devon's user avatar
  • 27
0 votes
1 answer
121 views

Adding a legend to gf_line plot in R

Hi I would like to add a legend to my chart in R. I am using the gf_line function. The data for plotting have the following structure: my_data_frame1.csv: "date","weekday","...
Pete23's user avatar
  • 3
0 votes
0 answers
386 views

Plotting a legend using legend(x,y ....) but x axis are dates in R

I'm trying to put a legend on a line graph using legend(x,y, legend=c("","").... etc. I've changed the date to numeric data and used that for x and it plots, so I know the rest of ...
Jack's user avatar
  • 3
0 votes
2 answers
208 views

Fixing legend in ggplot

I am plotting a scatter plot with 4 geom_ablines. The current plot looks like below: I want to make two changes in the legend of this plot. Removing the dot points on lines in the legend. Making the ...
Muhammad Usama Ashraf's user avatar
0 votes
1 answer
38 views

How can I change my R code so that there are three lines representing data from different blocks? How can I change my code to edit the legend?

Here is the code I used to produce my figure: Running_Accuracy_Across_Addition %>% ggplot(mapping = aes(x = Trials, y = Accuracy, group = Block, color = Block)) + scale_x_discrete(name = "...
Olivia's user avatar
  • 1
0 votes
0 answers
32 views

How to get linetype and color in same the legend?

I cannot seem to get the linetype and color to display in the same legend, it will display two legends; one with lines and one with the colors. what am I missing? Data_basinflow_pivot %>% filter(...
Kayla's user avatar
  • 59
1 vote
2 answers
232 views

Add legend to ggplot line graph based on linetype

I am trying to add a legend to a ggplot graph that uses solid and dashed lines. require(ggplot2) DATE <- c("2020-10-14", "2020-10-15", "2020-10-16", "2020-10-17&...
Borealis's user avatar
  • 8,354
0 votes
1 answer
1k views

Legend ggplot interaction different colours and line types [duplicate]

I've tried all day to get a line plot with different line colours and types but now that I managed that, the legend doesn't appear anymore. The first 10 (of 100) rows of the dataframe: Duration ...
Cathrin's user avatar
  • 51
0 votes
1 answer
69 views

line plot using ggplot2 with customized legend

I have three different data set, > dput(logit_mean) structure(c(1.34189585608394, 0.847629766112133, 0.502984724184437, 0.293946235601552, 0.206499805664176, 0.226630939673008, 0....
MNU's user avatar
  • 764
0 votes
1 answer
40 views

Using aes() to recolor only one line in a ggplot

I have a set of data that looks like this: Year Region Yield 2009 northeast 9.1 2009 northwest 8 2009 yorkshire 7.8 2009 eastmidlands 8.1 2009 westmidlands 7.9 ... 2016 Average 8....
dezza's user avatar
  • 15
3 votes
1 answer
4k views

Multiple Line Plots in ggplot with different colors of points and legend for line and points

I have the following data set data = data.frame(tmu = c(0.1164966,0.01649658, 0.605479878,0.073743729, 0.21649659,0.543409994,0.1164966,0.01649658,0.605479878, 0.073743729,0....
score324's user avatar
  • 707
2 votes
1 answer
292 views

Regression line in legend should be thinner

I am ploting points with regression line. Size of points is in a variable. Regression line in legend is plotted with different width than in my graph. df = data.frame( x=1:20, y=(1:20)^ 2 , t=20:1 ) ...
jlopez's user avatar
  • 347
0 votes
1 answer
3k views

How to add a legend on a multiple line graph in R?

I am trying to plot two different datasets on the same plot. I am using this code to add the lines and to actually plot everything ggplot()+ geom_point(data=Acc, aes(x=Year, y=Accumulo), color="...
Raffaello Nardin's user avatar

15 30 50 per page