Skip to content

Instantly share code, notes, and snippets.

@shaybensasson
Created March 7, 2015 16:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shaybensasson/e41a07ae28b197897618 to your computer and use it in GitHub Desktop.
Save shaybensasson/e41a07ae28b197897618 to your computer and use it in GitHub Desktop.
line plot transparency(alpha)
xlim([1,5]);
hold('on');
h1a = plot(1:5, 11:15, '.-', 'LineWidth',10, 'DisplayName',' 0.5');
h1b = plot(1.5:5.5, 11:15, '.-', 'LineWidth',10, 'DisplayName',' 1.0', 'Color',h1a.Color); % 100% opaque
h1a.Color(4) = 0.5; % 50% transparent
h2a = plot(3:7, 15:-1:11, '.-r', 'LineWidth',8, 'DisplayName',' 0.3'); h2a.Color(4)=0.3; % 70% transparent
h2b = plot(2:6, 15:-1:11, '.-r', 'LineWidth',8, 'DisplayName',' 0.7'); h2b.Color(4)=0.7; % 30% transparent
h2c = plot(1:5, 15:-1:11, '.-r', 'LineWidth',8, 'DisplayName',' 1.0'); % 100% opaque = 0% transparent
legend('show','Location','west')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment