Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
MaggiB
Regular Visitor

How to display multiple lines associated with one legend color?

I am plotting athlete reaction time (y-axis) on different days (x-axis).  I have 5 athletes and I want each to have their own line, as seen in the example, but I only want four line colors because two of the athletes are taking the same amount of vitamins (80mg).  right now the legend is a combination of dose (mg) and ID#, but I really only want four in the legend with just dose.  However, if I change my legend to dose, the chart summarizes the pink and yellow lines & only displays one line.  Please help, how can I get 5 lines with only 4 in legend.  [i realize i could manually change the yellow to pink, but I have about 20 of these charts and I do not want that manual work for each report, also do not want the 5 dots at top (only four).]   Thank you!

 

example_lines.png

 

 

1 ACCEPTED SOLUTION

Thank you so much for looking into this.  As a note for other readers, I found that it might be possible with the ggplot2 package from R, but I have not yet tested.  Again thank you, and we can close this question.

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hi @MaggiB,

In your scenario, there is no automatic way  to change the line color, you have to manually change the yellow to pink. And unless you change the legend to does, you will have 5 dots at top.

Thanks,
Lydia Zhang

Is there a way to do it with R-programming?

Anonymous
Not applicable

Hi @MaggiB,

Based on my reserach, it is not possible to use R to create multiple lines that associate with only one legend.

Thanks,
Lydia Zhang

Thank you so much for looking into this.  As a note for other readers, I found that it might be possible with the ggplot2 package from R, but I have not yet tested.  Again thank you, and we can close this question.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors