halfway merged and pulled?!
This commit is contained in:
133
Libs/wesanderson_colors/WesPalette.m
Normal file
133
Libs/wesanderson_colors/WesPalette.m
Normal file
@@ -0,0 +1,133 @@
|
||||
classdef WesPalette
|
||||
% WESPALETTE Wes Anderson color palettes with auto-completion
|
||||
% Usage:
|
||||
% cmap = WesPalette.Zissou1.rgb()
|
||||
% cmap = WesPalette.Zissou1.rgb(3)
|
||||
|
||||
% https://github.com/karthik/wesanderson?tab=readme-ov-file
|
||||
|
||||
enumeration
|
||||
BottleRocket1
|
||||
BottleRocket2
|
||||
Rushmore1
|
||||
Rushmore
|
||||
Royal1
|
||||
Royal2
|
||||
Zissou1
|
||||
Zissou1Continuous
|
||||
Darjeeling1
|
||||
Darjeeling2
|
||||
Chevalier1
|
||||
FantasticFox1
|
||||
Moonrise1
|
||||
Moonrise2
|
||||
Moonrise3
|
||||
Cavalcanti1
|
||||
GrandBudapest1
|
||||
GrandBudapest2
|
||||
IsleofDogs1
|
||||
IsleofDogs2
|
||||
FrenchDispatch
|
||||
AsteroidCity1
|
||||
AsteroidCity2
|
||||
AsteroidCity3
|
||||
end
|
||||
|
||||
methods
|
||||
function cmap = rgb(obj, n)
|
||||
% Return palette as Nx3 RGB colormap [0–1]
|
||||
|
||||
hex = obj.hex();
|
||||
|
||||
rgb = hex2rgb(hex);
|
||||
|
||||
if nargin == 2
|
||||
if n > size(rgb,1)
|
||||
error('Requested %d colors, but only %d available.', ...
|
||||
n, size(rgb,1))
|
||||
end
|
||||
cmap = rgb(1:n,:);
|
||||
else
|
||||
cmap = rgb;
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
methods (Access = private)
|
||||
function hex = hex(obj)
|
||||
% Internal HEX storage
|
||||
|
||||
switch obj
|
||||
case WesPalette.BottleRocket1
|
||||
hex = {'#A42820','#5F5647','#9B110E','#3F5151','#4E2A1E','#550307','#0C1707'};
|
||||
|
||||
case WesPalette.BottleRocket2
|
||||
hex = {'#FAD510','#CB2314','#273046','#354823','#1E1E1E'};
|
||||
|
||||
case {WesPalette.Rushmore1, WesPalette.Rushmore}
|
||||
hex = {'#E1BD6D','#EABE94','#0B775E','#35274A','#F2300F'};
|
||||
|
||||
case WesPalette.Royal1
|
||||
hex = {'#899DA4','#C93312','#FAEFD1','#DC863B'};
|
||||
|
||||
case WesPalette.Royal2
|
||||
hex = {'#9A8822','#F5CDB4','#F8AFA8','#FDDDA0','#74A089'};
|
||||
|
||||
case WesPalette.Zissou1
|
||||
hex = {'#3B9AB2','#78B7C5','#EBCC2A','#E1AF00','#F21A00'};
|
||||
|
||||
case WesPalette.Zissou1Continuous
|
||||
hex = {'#3A9AB2','#6FB2C1','#91BAB6','#A5C2A3','#BDC881', ...
|
||||
'#DCCB4E','#E3B710','#E79805','#EC7A05','#EF5703','#F11B00'};
|
||||
|
||||
case WesPalette.Darjeeling1
|
||||
hex = {'#FF0000','#00A08A','#F2AD00','#F98400','#5BBCD6'};
|
||||
|
||||
case WesPalette.Darjeeling2
|
||||
hex = {'#ECCBAE','#046C9A','#D69C4E','#ABDDDE','#000000'};
|
||||
|
||||
case WesPalette.Chevalier1
|
||||
hex = {'#446455','#FDD262','#D3DDDC','#C7B19C'};
|
||||
|
||||
case WesPalette.FantasticFox1
|
||||
hex = {'#DD8D29','#E2D200','#46ACC8','#E58601','#B40F20'};
|
||||
|
||||
case WesPalette.Moonrise1
|
||||
hex = {'#F3DF6C','#CEAB07','#D5D5D3','#24281A'};
|
||||
|
||||
case WesPalette.Moonrise2
|
||||
hex = {'#798E87','#C27D38','#CCC591','#29211F'};
|
||||
|
||||
case WesPalette.Moonrise3
|
||||
hex = {'#85D4E3','#F4B5BD','#9C964A','#CDC08C','#FAD77B'};
|
||||
|
||||
case WesPalette.Cavalcanti1
|
||||
hex = {'#D8B70A','#02401B','#A2A475','#81A88D','#972D15'};
|
||||
|
||||
case WesPalette.GrandBudapest1
|
||||
hex = {'#F1BB7B','#FD6467','#5B1A18','#D67236'};
|
||||
|
||||
case WesPalette.GrandBudapest2
|
||||
hex = {'#E6A0C4','#C6CDF7','#D8A499','#7294D4'};
|
||||
|
||||
case WesPalette.IsleofDogs1
|
||||
hex = {'#9986A5','#79402E','#CCBA72','#0F0D0E','#D9D0D3','#8D8680'};
|
||||
|
||||
case WesPalette.IsleofDogs2
|
||||
hex = {'#EAD3BF','#AA9486','#B6854D','#39312F','#1C1718'};
|
||||
|
||||
case WesPalette.FrenchDispatch
|
||||
hex = {'#90D4CC','#BD3027','#B0AFA2','#7FC0C6','#9D9C85'};
|
||||
|
||||
case WesPalette.AsteroidCity1
|
||||
hex = {'#0A9F9D','#CEB175','#E54E21','#6C8645','#C18748'};
|
||||
|
||||
case WesPalette.AsteroidCity2
|
||||
hex = {'#C52E19','#AC9765','#54D8B1','#B67C3B','#175149','#AF4E24'};
|
||||
|
||||
case WesPalette.AsteroidCity3
|
||||
hex = {'#FBA72A','#D3D4D8','#CB7A5C','#5785C1'};
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
20
Libs/wesanderson_colors/hex2rgb.m
Normal file
20
Libs/wesanderson_colors/hex2rgb.m
Normal file
@@ -0,0 +1,20 @@
|
||||
function rgb = hex2rgb(hex)
|
||||
% HEX2RGB Convert HEX color codes to RGB [0–1]
|
||||
|
||||
if ischar(hex)
|
||||
hex = {hex};
|
||||
end
|
||||
|
||||
n = numel(hex);
|
||||
rgb = zeros(n,3);
|
||||
|
||||
for k = 1:n
|
||||
h = hex{k};
|
||||
h = strrep(h,'#','');
|
||||
rgb(k,1) = hex2dec(h(1:2));
|
||||
rgb(k,2) = hex2dec(h(3:4));
|
||||
rgb(k,3) = hex2dec(h(5:6));
|
||||
end
|
||||
|
||||
rgb = rgb / 255;
|
||||
end
|
||||
64
Libs/wesanderson_colors/minimal_example_wespalette.m
Normal file
64
Libs/wesanderson_colors/minimal_example_wespalette.m
Normal file
@@ -0,0 +1,64 @@
|
||||
x = -10:2:25; % Input power [dBm]
|
||||
|
||||
y1 = 1e-5 * 10.^(0.12*x); % Dispersion-only
|
||||
y2 = 1e0 ./ (1 + exp(-0.4*(x-12))); % NLPN
|
||||
y3 = 1e-6 * 10.^(0.45*x); % RP on gamma
|
||||
y4 = 1e-2 * 10.^(0.18*(x-8)); % RP on beta2
|
||||
|
||||
cmap = WesPalette.AsteroidCity1.rgb(4);
|
||||
cmap = linspecer(4);
|
||||
figure1=figure(202998);clf;hold on
|
||||
lw = 0.8; ms = 4;
|
||||
plot(x,y1,'LineWidth',lw,'Color',cmap(1,:),'Marker','o','MarkerEdgeColor',cmap(1,:),'MarkerFaceColor',[1,1,1],'MarkerSize',ms);
|
||||
plot(x,y2,'LineWidth',lw,'Color',cmap(2,:),'Marker','square','MarkerEdgeColor',cmap(2,:),'MarkerFaceColor',[1,1,1],'MarkerSize',ms);
|
||||
plot(x,y3,'LineWidth',lw,'Color',cmap(3,:),'Marker','o','MarkerEdgeColor',cmap(3,:),'MarkerFaceColor',[1,1,1],'MarkerSize',ms);
|
||||
plot(x,y4,'LineWidth',lw,'Color',cmap(4,:),'Marker','o','MarkerEdgeColor',cmap(4,:),'MarkerFaceColor',[1,1,1],'MarkerSize',ms);
|
||||
yline(3.8e-3)
|
||||
|
||||
grid on
|
||||
xlabel('Input power [dBm]')
|
||||
ylabel('NSD ($\%$)')
|
||||
legend({'Dispersion','NLPN','RP','RP on $\beta_2$'}, ...
|
||||
'Location','best')
|
||||
|
||||
grid off
|
||||
set(gca,'MinorGridLineWidth',0.5);
|
||||
set(gca,'GridLineWidth',0.5,'GridLineStyle','--','GridColor',[0.9,0.9,0.9]);
|
||||
|
||||
set(gca,'FontSize',12,'YScale','log');
|
||||
ylim([1e-6 1e3])
|
||||
xlim([-10 23])
|
||||
|
||||
% % Create textarrow
|
||||
% annotation(figure1,'textarrow',[0.564444444444444 0.548148148148148],...
|
||||
% [0.768523809523809 0.63047619047619],'String',{'(A)'});
|
||||
%
|
||||
% % Create doublearrow
|
||||
% annotation(figure1,'doublearrow',[0.724444444444444 0.699259259259259],...
|
||||
% [0.854238095238095 0.723809523809524]);
|
||||
%
|
||||
% % Create line
|
||||
% annotation(figure1,'line',[0.700740740740741 0.699259259259259],...
|
||||
% [0.554285714285714 0.405714285714286]);
|
||||
%
|
||||
% % Create textbox
|
||||
% annotation(figure1,'textbox',...
|
||||
% [0.578777777777778 0.194285714285714 0.104185185185185 0.0685714285714286],...
|
||||
% 'String',{'BOX'},...
|
||||
% 'FitBoxToText','off');
|
||||
|
||||
%
|
||||
fig_path = 'C:\Users\Silas\Documents\Dissertation\00_Examples\tikz\textfig.tikz';
|
||||
matlab2tikz(fig_path, ...
|
||||
'width','\fwidth', ...
|
||||
'height','\fheight', ...
|
||||
'showInfo',false, ...
|
||||
'extraAxisOptions',{ ...
|
||||
'legend style={font=\footnotesize}', ...
|
||||
'xlabel style={font=\color{white!15!black},font=\small},',...
|
||||
'ylabel style={font=\color{white!15!black},font=\small},',...
|
||||
'legend columns=1', ...
|
||||
'every axis/.append style={font=\scriptsize}',...
|
||||
'legend columns=2',...
|
||||
'legend style={at={(0.02,0.98)},font=\footnotesize,draw=black!60,rounded corners=2pt,inner sep=1pt,fill=white,column sep=6pt,anchor= north west}',...
|
||||
});
|
||||
79
Libs/wesanderson_colors/wes_palettes.m
Normal file
79
Libs/wesanderson_colors/wes_palettes.m
Normal file
@@ -0,0 +1,79 @@
|
||||
function palettes = wes_palettes()
|
||||
% WES_PALETTES Full Wes Anderson color palette collection for MATLAB
|
||||
% Colors are stored as HEX and converted to RGB on demand.
|
||||
|
||||
palettes = struct();
|
||||
|
||||
palettes.BottleRocket1 = { ...
|
||||
'#A42820', '#5F5647', '#9B110E', '#3F5151', '#4E2A1E', '#550307', '#0C1707'};
|
||||
|
||||
palettes.BottleRocket2 = { ...
|
||||
'#FAD510', '#CB2314', '#273046', '#354823', '#1E1E1E'};
|
||||
|
||||
palettes.Rushmore1 = { ...
|
||||
'#E1BD6D', '#EABE94', '#0B775E', '#35274A', '#F2300F'};
|
||||
|
||||
palettes.Rushmore = palettes.Rushmore1;
|
||||
|
||||
palettes.Royal1 = { ...
|
||||
'#899DA4', '#C93312', '#FAEFD1', '#DC863B'};
|
||||
|
||||
palettes.Royal2 = { ...
|
||||
'#9A8822', '#F5CDB4', '#F8AFA8', '#FDDDA0', '#74A089'};
|
||||
|
||||
palettes.Zissou1 = { ...
|
||||
'#3B9AB2', '#78B7C5', '#EBCC2A', '#E1AF00', '#F21A00'};
|
||||
|
||||
palettes.Zissou1Continuous = { ...
|
||||
'#3A9AB2', '#6FB2C1', '#91BAB6', '#A5C2A3', '#BDC881', ...
|
||||
'#DCCB4E', '#E3B710', '#E79805', '#EC7A05', '#EF5703', '#F11B00'};
|
||||
|
||||
palettes.Darjeeling1 = { ...
|
||||
'#FF0000', '#00A08A', '#F2AD00', '#F98400', '#5BBCD6'};
|
||||
|
||||
palettes.Darjeeling2 = { ...
|
||||
'#ECCBAE', '#046C9A', '#D69C4E', '#ABDDDE', '#000000'};
|
||||
|
||||
palettes.Chevalier1 = { ...
|
||||
'#446455', '#FDD262', '#D3DDDC', '#C7B19C'};
|
||||
|
||||
palettes.FantasticFox1 = { ...
|
||||
'#DD8D29', '#E2D200', '#46ACC8', '#E58601', '#B40F20'};
|
||||
|
||||
palettes.Moonrise1 = { ...
|
||||
'#F3DF6C', '#CEAB07', '#D5D5D3', '#24281A'};
|
||||
|
||||
palettes.Moonrise2 = { ...
|
||||
'#798E87', '#C27D38', '#CCC591', '#29211F'};
|
||||
|
||||
palettes.Moonrise3 = { ...
|
||||
'#85D4E3', '#F4B5BD', '#9C964A', '#CDC08C', '#FAD77B'};
|
||||
|
||||
palettes.Cavalcanti1 = { ...
|
||||
'#D8B70A', '#02401B', '#A2A475', '#81A88D', '#972D15'};
|
||||
|
||||
palettes.GrandBudapest1 = { ...
|
||||
'#F1BB7B', '#FD6467', '#5B1A18', '#D67236'};
|
||||
|
||||
palettes.GrandBudapest2 = { ...
|
||||
'#E6A0C4', '#C6CDF7', '#D8A499', '#7294D4'};
|
||||
|
||||
palettes.IsleofDogs1 = { ...
|
||||
'#9986A5', '#79402E', '#CCBA72', '#0F0D0E', '#D9D0D3', '#8D8680'};
|
||||
|
||||
palettes.IsleofDogs2 = { ...
|
||||
'#EAD3BF', '#AA9486', '#B6854D', '#39312F', '#1C1718'};
|
||||
|
||||
palettes.FrenchDispatch = { ...
|
||||
'#90D4CC', '#BD3027', '#B0AFA2', '#7FC0C6', '#9D9C85'};
|
||||
|
||||
palettes.AsteroidCity1 = { ...
|
||||
'#0A9F9D', '#CEB175', '#E54E21', '#6C8645', '#C18748'};
|
||||
|
||||
palettes.AsteroidCity2 = { ...
|
||||
'#C52E19', '#AC9765', '#54D8B1', '#B67C3B', '#175149', '#AF4E24'};
|
||||
|
||||
palettes.AsteroidCity3 = { ...
|
||||
'#FBA72A', '#D3D4D8', '#CB7A5C', '#5785C1'};
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user