Color change in plots

2 次查看(过去 30 天)
Camilla
Camilla 2024-6-3
Hello Y'all,
I have a figure in which two curves are shown. The Problem is that both curves overlap so its hard to properly see both curves. Im trying to make the colors more transparent so that you can clearly see both curves despite the overlap.
I attached the Figure below.
Thank u in advance
% Plot for CS+ und CS-
figure;
shadedErrorBar(time_vector, mean_curve2_all_CS_plus, se_CS_plus, {'-r', 'LineWidth', 2});
hold on;
shadedErrorBar(time_vector, mean_curve2_all_CS_minus, se_CS_minus, {'-b', 'LineWidth', 2});
hold off;
xlabel('Zeit');
ylabel('Mittelwert');
title('Durchschnittliche Mittelwerte für CS+ und CS-');
legend('CS+', 'CS-');
  1 个评论
Image Analyst
Image Analyst 2024-6-3
Make it easy for us to answer you. Please insert a screenshot into your message, or at least a PNG file so we can view it here without downloading it and going to MATLAB to open it up (less convenient).

请先登录,再进行评论。

回答(1 个)

Matlab Pro
Matlab Pro 2024-6-3
Hi
I have seen your attached fig (better to attach (also) a *.png file as @Image Analyst commented
Anyhow - you use "shadedErrorBar" function (Xchange server link: https://www.mathworks.com/matlabcentral/fileexchange/26311-raacampbell-shadederrorbar
)
If you are looking @ the "demo_shadedErrorBar_live.mlx" file - line 36 is:
shadedErrorBar(x, y, {@mean,@std}, 'lineprops', '-r','transparent',false,'patchSaturation',0.075)
You can control tranparancy by setting: 'transparent' to 'true' and tune the 'patchSaturation' to the desired tranparant requested
Explicitly:
change to:
shadedErrorBar(x, y, {@mean,@std}, 'lineprops', '-r','transparent',true,'patchSaturation',0.075)
and view the result (red line)
Before
Before
After
After
Good luck

Community Treasure Hunt

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

Start Hunting!

Translated by