Making a Line Graph with Multiple Lines

I want to indicate a data point only on the Result line chart of a graph but not for the other line charts. Want lines and show data points only for the result category but not for other category. I want all other line without data points. Any help how I can tweak my code in R?!

Please check the image. I marked with yellow colours.

myColors = c("-1SD"="#00FF00", "-2SD"="#FFFF00", "-3SD"="#FF0000", "+1SD"="#00FF00",
             "+2SD"="#FFFF00", "+3SD"="#FF0000", "ExpectedValue"="#808080", "Result"="#1D376C")
myLineType = c("-1SD"="dashed", "-2SD"="twodash", "-3SD"="longdash", "+1SD"="dashed",
             "+2SD"="twodash", "+3SD"="longdash", "ExpectedValue"="dotted", "Result"="dotdash")      
g<-ggplot(data=Values,aes(x=DateSampleID, y=Value, a=SampleID, b=Result, group=Category, label=Category)) +
  geom_line(aes(linetype = Category, color= Category), size=0.6, alpha=0.8)+
  labs(x = "DateSampleID",
       y = "Result") +
  theme_minimal(base_size = 12, base_family ="Segoe UI Bold")+
  theme(axis.text.x = element_blank(), 
        axis.ticks.x = element_blank(),
        axis.title.x = element_text(family="Segoe UI",size=12, face="bold", colour = "black"), 
        panel.grid.major = element_blank(),
        panel.grid.minor = element_blank(),
        legend.title = element_blank(),
        axis.text.y = element_text(family="Segoe UI",size=12,face="bold", colour="black"),
        axis.title.y = element_text(family="Segoe UI",size=12,face="bold", colour="black"),
        legend.text = element_text(family="Segoe UI",size=10,face="bold", colour="black"))+
  scale_linetype_manual(values = myLineType)+      
  scale_color_manual(values = myColors)

It would be very helpful to have some data to plot with your code. Please post the output of


Where Values is the data frame you used to get the plot you showed in your question. Paste the output between lines with three back ticks, like this
dput(Values) output here
I do not understand what you do not like about the plot you have in your question. Only the Results line has data points. Is that plot produced by different code than the code you posted?

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.