Last active
July 14, 2019 14:34
-
-
Save Remi-Gau/166b786546067f47211911d449b60d8f to your computer and use it in GitHub Desktop.
Plot matlab color map with transparency on x axis
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
G = figure('color', [.5 .5 .5], 'Units', 'Normalized', 'Position', [0.5, 0.4, 0.06, 0.35]); | |
CM = colormap; | |
% x represents the range in alpha (e.g abs(t-stats)) | |
x = linspace(1, 1000, 256); | |
% y represents the range in hue (e.g power) | |
y = linspace(1, 1000, 1000); | |
[X,Y] = meshgrid(x,y); % Transform into a 2D matrix | |
axis xy; | |
box on | |
xlabel('t value') | |
ylabel('power') | |
set(gca, 'Xcolor', 'k', 'Ycolor', 'k') | |
set(gca, 'YAxisLocation', 'right') | |
% Plot the colorbar | |
imagesc(x,y,Y); | |
colormap(flipud(CM)); | |
alpha(X); | |
alpha('scaled'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment