How to customise legend?
Show older comments
This is probably a very stupid question, but how do I fix this?
Like data1 corresponds to the dark blue of -24°C, but I want the diamonds as one colour, aka orange. So my question is,
How do I adjust the legend so that it shows those 10 temperatures, but only one orange diamond?
I have tried this:
legend(temperatures,{'δ data'})
but the array shows complications.
Here is the code, sorry if it's "messy" or confusing.
for i = 1:10
colororder(clrs)
frequency = SE1Ofreq(:,i);
complex = SE1Ocomp(:,i);
scatter(frequency,complex,50,'filled','MarkerEdgeColor','black')
set(gca,'yscale','log')
set(gca,'xscale','log')
hold on
end
title('Master curve SE-1 Original')
ax = gca;
ax.FontSize = 14;
xlabel('\omega (rad/s)')
ylabel('G* (Pa)')
hold on
legend(temperatures)
yyaxis right
ylabel('δ (°)')
for j = 1:10
frequency1 = SE1Ofreq(:,j);
phase1 = SE1Ophas(:,j);
scatter(frequency1,phase1,50,[0.8500 0.3250 0.0980],'d','filled','MarkerEdgeColor','black')
hold on
end
grid on
ylim([0 90])

3 Comments
Scott MacKenzie
on 26 Jul 2021
It would help if you posted the code that generates the plot.
Herline van der Spuy
on 26 Jul 2021
Scott MacKenzie
on 26 Jul 2021
Edited: Scott MacKenzie
on 26 Jul 2021
I didn't say explicitly, but I meant "code that can be executed"; i.e., if the data are not embedded in the code, then post the data as well.
Accepted Answer
More Answers (0)
Categories
Find more on Legend in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!