How to add a legend entry for labels

2 views (last 30 days)
Joey Biever
Joey Biever on 28 Feb 2022
Commented: Arif Hoq on 28 Feb 2022
I have 3 data points on a plot that each have a label adjacent to them displaying a percent value: an x marker with a [110%] NE of it for example.
In my legend, I would like to add an entry that looks like this: '[%] = Dp' so that readers know the percentages displayed next to points represent the dilution percentage.
How can I add this to my legend and keep it looking professional? Thanks!
  4 Comments
KSSV
KSSV on 28 Feb 2022
Data is not required.....an example will do. What you showed is a legit answer.
Arif Hoq
Arif Hoq on 28 Feb 2022
noted.. thank you very much.

Sign in to comment.

Answers (1)

Arif Hoq
Arif Hoq on 28 Feb 2022
you did not attach your data here. I have taken a simple plot example here. you can just rename in the legend function whatever you want.
x = linspace(0,pi);
y1 = cos(x);
plot(x,y1)
hold on
y2 = cos(2*x);
plot(x,y2)
hold off
lgd = legend('[10%] = Dp','[20%] = Dp');

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!