<em>Mac</em>Book项目 2009年学校开始实施<em>Mac</em>Book项目,所有师生配备一本<em>Mac</em>Book,并同步更新了校园无线网络。学校每周进行电脑技术更新,每月发送技术支持资料,极大改变了教学及学习方式。因此2011
2021-06-01 09:32:01
本期推播教大家如何繪製各種樣式的山脊圖,這裡做了一個工具函數用來實現好看的山脊圖的繪製,編寫不易請多多點贊,大體繪製效果如下:
依舊工具函數放在文末。
X1=normrnd(2,2,1,50); X2=[normrnd(4,4,1,50),normrnd(5,2,1,50)]; X3=[normrnd(6,2,1,50),normrnd(8,4,1,50)]; X4=[normrnd(12,1,1,50),normrnd(12,4,1,50)]; X5=[normrnd(10,2,1,50),normrnd(10,4,1,50)]; X6=[normrnd(7,2,1,50),normrnd(7,4,1,50)]; X7=[normrnd(4,2,1,50),normrnd(4,4,1,50)]; Data={X1,X2,X3,X4,X5,X6,X7};
資料為多個一維向量放在元胞陣列中,大概像這樣:
通過設定ColorMode
屬性設定上色方式,可設定為:
Qt Order:每個山脊不同顏色
JP=joyPlot(Data,'ColorMode','Order'); JP=JP.draw();
繪製並新增圖例(同時可以通過MedLine設定顯示中位線):
JP=joyPlot(Data,'ColorMode','Order','MedLine','on'); JP=JP.draw(); legendHdl=JP.getLegendHdl(); legend(legendHdl)
可以通過設定ColorList
屬性或者使用setPatchColor
函數設定顏色,推薦前者:
ColorList
屬性設定顏色:
newColorList=[0.1059 0.6196 0.4667 0.8510 0.3725 0.0078 0.4588 0.4392 0.7020 0.6529 0.4059 0.3294 0.9020 0.6706 0.0078 0.6510 0.4627 0.1137 0.4000 0.4000 0.4000]; JP=joyPlot(Data,'ColorMode','Order','ColorList',newColorList); JP=JP.draw(); legendHdl=JP.getLegendHdl(); legend(legendHdl)
setPatchColor
函數設定顏色,只能設定面顏色設定不了線條顏色:
JP=joyPlot(Data,'ColorMode','Order'); JP=JP.draw(); legendHdl=JP.getLegendHdl(); legend(legendHdl) % 設定山脊顏色 newColorList=[0.1059 0.6196 0.4667 0.8510 0.3725 0.0078 0.4588 0.4392 0.7020 0.6529 0.4059 0.3294 0.9020 0.6706 0.0078 0.6510 0.4627 0.1137 0.4000 0.4000 0.4000]; JP=JP.setPatchColor(newColorList)
當然可以全部設定為同一顏色:
JP=joyPlot(Data,'ColorMode','Order','ColorList',[0,0,.6]); JP=JP.draw(); legendHdl=JP.getLegendHdl(); legend(legendHdl(1))
X 每個山脊分別把X對映為顏色
JP=joyPlot(Data,'ColorMode','X','MedLine','on'); JP=JP.draw();
當然可以新增colorbar:
colorbar()
設定為其他顏色:
JP=JP.setPatchColor(winter);
JP=JP.setPatchColor(colorcube(256));
GlobalX 全域性性把X座標對映為顏色
Data={X1,X2,X3,X4,X5,X6,X7}; JP=joyPlot(Data,'ColorMode','GlobalX','MedLine','on'); JP=JP.draw(); colorbar
換成別的顏色:
JP=JP.setPatchColor(colorcube(256));
Kdensity 依靠核密度
Data={X1,X2,X3,X4,X5,X6,X7}; JP=joyPlot(Data,'ColorMode','Kdensity','MedLine','on'); JP=JP.draw(); colorbar
換成別的顏色:
JP=JP.setPatchColor(turbo);
Qt 分位染色
預設是0.25,0.75分位染色:
JP=joyPlot(Data,'ColorMode','Qt','MedLine','on'); JP=JP.draw(); legendHdl=JP.getLegendHdl(); legend(legendHdl)
修改分位線(通過設定Quantiles
屬性):
JP=joyPlot(Data,'ColorMode','Qt','MedLine','on','Quantiles',[.1,.9]); JP=JP.draw(); legendHdl=JP.getLegendHdl(); legend(legendHdl)
繪製分位線(可將QtLine
設定為on
):
JP=joyPlot(Data,'ColorMode','Qt','MedLine','on','Quantiles',[.1,.9],'QtLine','on'); JP=JP.draw(); legendHdl=JP.getLegendHdl(); legend(legendHdl)
值得一提的是,所有染色方式都可以繪製QtLine分位線:
JP=joyPlot(Data,'ColorMode','Order','MedLine','on','Quantiles',[.1,.9],'QtLine','on'); JP=JP.draw(); legendHdl=JP.getLegendHdl(); legend(legendHdl)
更多分位線和更豐富配色:
JP=joyPlot(Data,'ColorMode','Qt','MedLine','on','Quantiles',[.1,.25,.75,.9],'ColorList',turbo(5),'QtLine','on'); JP=JP.draw(); legendHdl=JP.getLegendHdl(); legend(legendHdl,{'0~0.1','0.1~0.25','0.25~0.75','0.75~0.9','0.9~1'})
更改配色:
JP=JP.setPatchColor(bone(6));
通過設定Sep
屬性設定間距,例如小間距:
JP=joyPlot(Data,'ColorMode','Kdensity','Sep',1/30); JP=JP.draw(); colorbar
間距設定為1/60:
設定大間距(1/3):
只有Order
型別配色不是黑色:
JP=joyPlot(Data,'ColorMode','Order','Scatter','on'); JP=JP.draw(); legendHdl=JP.getLegendHdl(); legend(legendHdl
Data={X1,X2,X3,X4,X5,X6,X7}; JP=joyPlot(Data,'ColorMode','GlobalX','MedLine','on','Scatter','on'); JP=JP.draw(); colorbar
每個玩意的屬性都可以單獨設定
例如:
JP=joyPlot(Data,'ColorMode','Order','Scatter','on','QtLine','on','MedLine','on','Sep',1/5); JP=JP.draw(); legendHdl=JP.getLegendHdl(); legend(legendHdl)
設定第3個山脊顏色和透明度:
JP.setRidgePatch(3,'FaceColor',[0,0,0],'FaceAlpha',.5)
迴圈改變所有的顏色和透明度:
for i=1:length(Data) JP.setRidgePatch(i,'FaceColor',[1,1,1]./length(Data).*i,'FaceAlpha',.5) end
其他玩意也都類似!
for i=1:length(Data) JP.setRidgePatch(i,'FaceColor',[1,1,1]./length(Data).*i,'FaceAlpha',.5) JP.setRidgeLine(i,'Color',[0,0,.8],'LineWidth',1) JP.setScatter(i,'Color',[0,0,0,.4]) JP.setMedLine(i,'Color',[0,0,.8]) JP.setQtLine(i,'Color',[0,0,.8]) end
舉個例子:
X1_1=normrnd(-15,2,1,20); X1_2=[normrnd(4,4,1,10),normrnd(5,2,1,10)]; X1_3=[normrnd(6,2,1,10),normrnd(8,4,1,10)]; X1_4=[normrnd(12,1,1,10),normrnd(12,4,1,10)]; X1_5=[normrnd(-7,2,1,10),normrnd(2,4,1,10)]; X1_6=[normrnd(-7,2,1,10),normrnd(-7,4,1,10)]; Data1={X1_1,X1_2,X1_3,X1_4,X1_5,X1_6}; X2_1=normrnd(-8,2,1,20); X2_2=[normrnd(2,4,1,10),normrnd(2,2,1,10)]; X2_3=[normrnd(18,2,1,10),normrnd(18,4,1,10)]; X2_4=[normrnd(18,1,1,10),normrnd(18,4,1,10)]; X2_5=[normrnd(5,2,1,10),normrnd(5,4,1,10)]; X2_6=[normrnd(-20,2,1,10),normrnd(-20,4,1,10)]; Data2={X2_1,X2_2,X2_3,X2_4,X2_5,X2_6}; JP1=joyPlot(Data1,'ColorMode','Order','ColorList',[12,165,154]./255,'MedLine','on','Scatter','on'); JP1=JP1.draw(); JP2=joyPlot(Data2,'ColorMode','Order','ColorList',[151,220,71]./255,'MedLine','on','Scatter','on'); JP2=JP2.draw(); % 設定中位線顏色 for i=1:length(Data1) JP1.setMedLine(i,'Color',[12,165,154]./255) end for i=1:length(Data2) JP2.setMedLine(i,'Color',[151,220,71]./255) end % 繪製圖例 legendHdl1=JP1.getLegendHdl(); legendHdl2=JP2.getLegendHdl(); legend([legendHdl1(1),legendHdl2(1)],{'AAAAA','BBBBB'})
classdef joyPlot % @author : slandarer % gzh : slandarer隨筆 % Zhaoxu Liu / slandarer (2023). joyplot % (https://www.mathworks.com/matlabcentral/fileexchange/125255-joyplot), % MATLAB Central File Exchange. 檢索來源 2023/2/23. properties ax,arginList={'ColorMode','ColorList','Sep','Scatter','MedLine','Quantiles','QtLine'} ColorMode='Order' % 上色模式'Order'/'X'/'GlobalX'/'Kdensity'/'Qt' ColorList defaultColorList1=[0.3725 0.2745 0.5647; 0.1137 0.4118 0.5882; 0.2196 0.6510 0.6471; 0.0588 0.5216 0.3294 0.4510 0.6863 0.2824; 0.9294 0.6784 0.0314; 0.8824 0.4863 0.0196; 0.8000 0.3137 0.2431 0.5804 0.2039 0.4314; 0.4353 0.2510 0.4392]; defaultColorList2=[0.0015 0.0005 0.0139; 0.0143 0.0122 0.0705; 0.0415 0.0323 0.1373; 0.0773 0.0535 0.2088; 0.1179 0.0664 0.2854; 0.1661 0.0678 0.3630; 0.2209 0.0609 0.4276; 0.2758 0.0616 0.4677; 0.3279 0.0755 0.4889; 0.3784 0.0954 0.5001; 0.4284 0.1160 0.5058; 0.4788 0.1357 0.5080; 0.5297 0.1541 0.5070; 0.5814 0.1715 0.5028; 0.6338 0.1882 0.4951; 0.6867 0.2051 0.4836; 0.7395 0.2231 0.4679; 0.7914 0.2438 0.4480; 0.8410 0.2692 0.4245; 0.8861 0.3019 0.3992; 0.9240 0.3441 0.3761; 0.9524 0.3958 0.3617; 0.9715 0.4540 0.3610; 0.9837 0.5147 0.3747; 0.9912 0.5758 0.4003; 0.9954 0.6364 0.4350; 0.9972 0.6964 0.4765; 0.9971 0.7559 0.5234; 0.9956 0.8150 0.5747; 0.9930 0.8739 0.6300; 0.9899 0.9327 0.6886; 0.9871 0.9914 0.7495]; defaultColorList3=[255,153,154;220,220,220;153,153,253]./255; Sep=1/8; % 兩個山脊間距離 Scatter='off'; % 是否繪製豎線狀散點 MedLine='off'; QtLine='off'; Quantiles=[.25,.75];QtX,QtY ridgeNum,Data,minX,maxX,maxY,XiSet,FSet ridgePatchHdl,ridgeLineHdl medLineHdl,scatterHdl;QtLineHdl;QtLegendHdl end methods function obj=joyPlot(Data,varargin) obj.Data=Data; obj.ridgeNum=length(obj.Data); % 獲取其他資料 disp(char([64 97 117 116 104 111 114 32 58 32,... 115 108 97 110 100 97 114 101 114])) for i=1:2:(length(varargin)-1) tid=ismember(obj.arginList,varargin{i}); if any(tid) obj.(obj.arginList{tid})=varargin{i+1}; end end if isempty(intersect(obj.ColorMode,{'Order','X','GlobalX','Kdensity','Qt'})) error('The ColorMode should be one of the following: Order X GlobalX Kdensity Qt') end switch obj.ColorMode case 'Order',obj.ColorList=obj.defaultColorList1; case 'X',obj.ColorList=obj.defaultColorList2; case 'GlobalX',obj.ColorList=obj.defaultColorList2; case 'Kdensity',obj.ColorList=obj.defaultColorList2; case 'Qt',obj.ColorList=obj.defaultColorList3; end for i=1:2:(length(varargin)-1) tid=ismember(obj.arginList,varargin{i}); if any(tid) obj.(obj.arginList{tid})=varargin{i+1}; end end obj.minX=min(obj.Data{1}); obj.maxX=max(obj.Data{1}); for i=1:obj.ridgeNum obj.minX=min(obj.minX,min(obj.Data{i})); obj.maxX=max(obj.maxX,max(obj.Data{i})); end end function obj=draw(obj) obj.ax=gca;hold on; obj.ax.LineWidth=1; obj.ax.YTick=(1:obj.ridgeNum).*obj.Sep; obj.ax.FontName='Cambria'; obj.ax.FontSize=13; obj.ax.YGrid='on'; % obj.ax.Box='on'; obj.ax.TickDir='out'; tYLabel{obj.ridgeNum}=''; for i=1:obj.ridgeNum tYLabel{i}=['Class-',num2str(i)]; end obj.ax.YTickLabel=tYLabel; % 調整初始介面大小 fig=obj.ax.Parent; fig.Color=[1,1,1]; if max(fig.Position(3:4))<690 fig.Position(3:4)=1.2.*fig.Position(3:4); fig.Position(1:2)=fig.Position(1:2)./2; end % 繪製patch影象 obj.minX=min(obj.Data{1}); obj.maxX=max(obj.Data{1}); obj.maxY=0; for i=1:obj.ridgeNum tX=obj.Data{i};tX=tX(:)'; [F,Xi]=ksdensity(tX); obj.minX=min(obj.minX,min(Xi)); obj.maxX=max(obj.maxX,max(Xi)); obj.maxY=max(obj.maxY,max(F)); end for i=obj.ridgeNum:-1:1 tX=obj.Data{i};tX=tX(:)'; [F,Xi]=ksdensity(tX); OXi=Xi; Xi=linspace(min(Xi),max(Xi),1000); F=interp1(OXi,F,Xi); obj.XiSet{i}=Xi; obj.FSet{i}=F; % 繪製豎線散點 tXX=[tX;tX;tX.*nan]; tYY=[tX.*0+obj.Sep.*i-obj.Sep./10;tX.*0+obj.Sep.*i-obj.Sep./2.5;tX.*nan]; if isequal(obj.ColorMode,'Order') obj.scatterHdl(i)=plot(tXX(:),tYY(:),'Color',[obj.ColorList(mod(i-1,size(obj.ColorList,1))+1,:),.5],'LineWidth',.8,'Visible','off'); else obj.scatterHdl(i)=plot(tXX(:),tYY(:),'Color',[0,0,0,.5],'LineWidth',.8,'Visible','off'); end if isequal(obj.Scatter,'on'),set(obj.scatterHdl(i),'Visible','on');end % 計算分位線 for j=1:length(obj.Quantiles) obj.QtX(i,j+1)=quantile(tX,obj.Quantiles(j)); obj.QtY(i,j)=interp1(Xi,F,quantile(tX,obj.Quantiles(j))); end obj.QtX(i,1)=min(Xi)-inf; obj.QtX(i,length(obj.Quantiles)+2)=max(Xi)+inf; switch obj.ColorMode case 'Order' obj.ridgePatchHdl(i)=fill([Xi(1),Xi,Xi(end)],[0,F,0]+obj.Sep.*(i).*ones(1,length(F)+2),... obj.ColorList(mod(i-1,size(obj.ColorList,1))+1,:),'EdgeColor','none','FaceAlpha',.5); obj.ridgeLineHdl(i)=plot([Xi(1),Xi,Xi(end)],[0,F,0]+obj.Sep.*(i).*ones(1,length(F)+2),... 'Color',obj.ColorList(mod(i-1,size(obj.ColorList,1))+1,:),'LineWidth',.8); colormap(obj.ColorList); try caxis([1,obj.ridgeNum]),catch,end try clim([1,obj.ridgeNum]),catch,end case 'X' tTi=[Xi(1),Xi,Xi(end),Xi(end:-1:1)]-min(Xi);tTi=tTi./max(tTi); tT=linspace(0,1,size(obj.ColorList,1)); tC=cat(3,interp1(tT,obj.ColorList(:,1),tTi),interp1(tT,obj.ColorList(:,2),tTi),interp1(tT,obj.ColorList(:,3),tTi)); obj.ridgePatchHdl(i)=fill([Xi(1),Xi,Xi(end),Xi(end:-1:1)],[0,F,0,F.*0]+obj.Sep.*(i).*ones(1,length(F)*2+2),... tC,'EdgeColor','none','FaceAlpha',.9,'FaceColor','interp'); obj.ridgeLineHdl(i)=plot([Xi(1),Xi,Xi(end)],[0,F,0]+obj.Sep.*(i).*ones(1,length(F)+2),... 'Color',[0,0,0,.9],'LineWidth',.8); colormap(obj.ColorList); try caxis([-1,1]),catch,end try clim([-1,1]),catch,end case 'GlobalX' tTi=[Xi(1),Xi,Xi(end),Xi(end:-1:1)]-obj.minX; tTi=tTi./(obj.maxX-obj.minX); tT=linspace(0,1,size(obj.ColorList,1)); tC=cat(3,interp1(tT,obj.ColorList(:,1),tTi),interp1(tT,obj.ColorList(:,2),tTi),interp1(tT,obj.ColorList(:,3),tTi)); obj.ridgePatchHdl(i)=fill([Xi(1),Xi,Xi(end),Xi(end:-1:1)],[0,F,0,F.*0]+obj.Sep.*(i).*ones(1,length(F)*2+2),... tC,'EdgeColor','none','FaceAlpha',.9,'FaceColor','interp'); obj.ridgeLineHdl(i)=plot([Xi(1),Xi,Xi(end)],[0,F,0]+obj.Sep.*(i).*ones(1,length(F)+2),... 'Color',[0,0,0,.9],'LineWidth',.8); colormap(obj.ColorList); try caxis([obj.minX,obj.maxX]),catch,end try clim([obj.minX,obj.maxX]),catch,end case 'Kdensity' tTi=[0,F,0,F(end:-1:1)]; tTi=tTi./obj.maxY; tT=linspace(0,1,size(obj.ColorList,1)); tC=cat(3,interp1(tT,obj.ColorList(:,1),tTi),interp1(tT,obj.ColorList(:,2),tTi),interp1(tT,obj.ColorList(:,3),tTi)); obj.ridgePatchHdl(i)=fill([Xi(1),Xi,Xi(end),Xi(end:-1:1)],[0,F,0,F.*0]+obj.Sep.*(i).*ones(1,length(F)*2+2),... tC,'EdgeColor','none','FaceAlpha',.9,'FaceColor','interp'); obj.ridgeLineHdl(i)=plot([Xi(1),Xi,Xi(end)],[0,F,0]+obj.Sep.*(i).*ones(1,length(F)+2),... 'Color',[0,0,0,.9],'LineWidth',.8); colormap(obj.ColorList); try caxis([0,obj.maxY]),catch,end try clim([0,obj.maxY]),catch,end case 'Qt' tTi=[Xi(1),Xi,Xi(end),Xi(end:-1:1)]; tR=tTi.*0;tG=tTi.*0;tB=tTi.*0; for j=1:size(obj.QtX,2)-1 tR(tTi>=obj.QtX(i,j)&tTi<obj.QtX(i,j+1))=obj.ColorList(mod(j-1,size(obj.ColorList,1))+1,1); tG(tTi>=obj.QtX(i,j)&tTi<obj.QtX(i,j+1))=obj.ColorList(mod(j-1,size(obj.ColorList,1))+1,2); tB(tTi>=obj.QtX(i,j)&tTi<obj.QtX(i,j+1))=obj.ColorList(mod(j-1,size(obj.ColorList,1))+1,3); end tC=cat(3,tR,tG,tB); obj.ridgePatchHdl(i)=fill([Xi(1),Xi,Xi(end),Xi(end:-1:1)],[0,F,0,F.*0]+obj.Sep.*(i).*ones(1,length(F)*2+2),... tC,'EdgeColor','none','FaceAlpha',.9,'FaceColor','interp'); obj.ridgeLineHdl(i)=plot([Xi(1),Xi,Xi(end)],[0,F,0]+obj.Sep.*(i).*ones(1,length(F)+2),... 'Color',[0,0,0,.9],'LineWidth',.8); colormap(obj.ColorList); try caxis([-1,1]),catch,end try clim([-1,1]),catch,end end % 繪製中位線 tMedX=median(tX); tMedY=interp1(Xi,F,tMedX); obj.medLineHdl(i)=plot([tMedX,tMedX],[0,tMedY]++obj.Sep.*[i,i],'LineStyle','--','LineWidth',1,'Color',[0,0,0],'Visible','off'); if isequal(obj.MedLine,'on'),set(obj.medLineHdl(i),'Visible','on');end % 繪製分位線 tQtY=[obj.QtY(i,:);obj.QtY(i,:).*0;obj.QtY(i,:).*nan]+obj.Sep.*i; tQtX=[obj.QtX(i,2:end-1);obj.QtX(i,2:end-1);obj.QtX(i,2:end-1).*nan]; obj.QtLineHdl(i)=plot(tQtX(:),tQtY(:),'LineWidth',1,'Color',[0,0,0,.8],'Visible','off'); if isequal(obj.QtLine,'on'),set(obj.QtLineHdl(i),'Visible','on');end % % 繪製25,75分位線 % tQt25X=quantile(tX,0.25); % tQt75X=quantile(tX,0.75); % tQt25Y=interp1(Xi,F,tQt25X); % tQt75Y=interp1(Xi,F,tQt75X); % obj.qt25LineHdl(i)=plot([tQt25X,tQt25X],[0,tQt25Y]+obj.Sep.*[i,i],'LineWidth',1,'Color',[1,1,1,.8],'Visible','off'); % obj.qt75LineHdl(i)=plot([tQt75X,tQt75X],[0,tQt75Y]+obj.Sep.*[i,i],'LineWidth',1,'Color',[1,1,1,.8],'Visible','off'); % if isequal(obj.QT25Line,'on'),set(obj.qt25LineHdl(i),'Visible','on');end % if isequal(obj.QT75Line,'on'),set(obj.qt75LineHdl(i),'Visible','on');end end axis tight obj.ax.YLim(1)=obj.Sep/2; for i=1:size(obj.QtX,2)-1 obj.QtLegendHdl(i)=fill(mean(obj.ax.XLim).*[1,1,1,1],mean(obj.ax.YLim).*[1,1,1,1],... obj.ColorList(mod(i-1,size(obj.ColorList,1))+1,:),'EdgeColor','none','FaceAlpha',.9); end end % 獲取繪製圖例物件 function legendHdl=getLegendHdl(obj) if isequal(obj.ColorMode,'Qt') legendHdl=obj.QtLegendHdl; else legendHdl=obj.ridgePatchHdl; end end % 顏色重設定 function obj=setPatchColor(obj,ColorList) obj.ColorList=ColorList; colormap(obj.ColorList); for i=obj.ridgeNum:-1:1 Xi=obj.XiSet{i}; F=obj.FSet{i}; switch obj.ColorMode case 'Order' set(obj.ridgePatchHdl(i),'FaceColor',obj.ColorList(mod(i-1,size(obj.ColorList,1))+1,:)); case 'X' tTi=[Xi(1),Xi,Xi(end),Xi(end:-1:1)]-min(Xi);tTi=tTi./max(tTi); tT=linspace(0,1,size(obj.ColorList,1)); tC=cat(3,interp1(tT,obj.ColorList(:,1),tTi),interp1(tT,obj.ColorList(:,2),tTi),interp1(tT,obj.ColorList(:,3),tTi)); set(obj.ridgePatchHdl(i),'CData',tC); case 'GlobalX' tTi=[Xi(1),Xi,Xi(end),Xi(end:-1:1)]-obj.minX; tTi=tTi./(obj.maxX-obj.minX); tT=linspace(0,1,size(obj.ColorList,1)); tC=cat(3,interp1(tT,obj.ColorList(:,1),tTi),interp1(tT,obj.ColorList(:,2),tTi),interp1(tT,obj.ColorList(:,3),tTi)); set(obj.ridgePatchHdl(i),'CData',tC); case 'Kdensity' tTi=[0,F,0,F(end:-1:1)]; tTi=tTi./obj.maxY; tT=linspace(0,1,size(obj.ColorList,1)); tC=cat(3,interp1(tT,obj.ColorList(:,1),tTi),interp1(tT,obj.ColorList(:,2),tTi),interp1(tT,obj.ColorList(:,3),tTi)); set(obj.ridgePatchHdl(i),'CData',tC); case 'Qt' tTi=[Xi(1),Xi,Xi(end),Xi(end:-1:1)]; tR=tTi.*0;tG=tTi.*0;tB=tTi.*0; for j=1:size(obj.QtX,2)-1 tR(tTi>=obj.QtX(i,j)&tTi<obj.QtX(i,j+1))=obj.ColorList(mod(j-1,size(obj.ColorList,1))+1,1); tG(tTi>=obj.QtX(i,j)&tTi<obj.QtX(i,j+1))=obj.ColorList(mod(j-1,size(obj.ColorList,1))+1,2); tB(tTi>=obj.QtX(i,j)&tTi<obj.QtX(i,j+1))=obj.ColorList(mod(j-1,size(obj.ColorList,1))+1,3); end tC=cat(3,tR,tG,tB); set(obj.ridgePatchHdl(i),'CData',tC); end end for i=1:size(obj.QtX,2)-1 set(obj.QtLegendHdl(i),'FaceColor',obj.ColorList(mod(i-1,size(obj.ColorList,1))+1,:)); end end % 設定Patch及Line物件其他屬性 function setRidgePatch(obj,n,varargin) set(obj.ridgePatchHdl(n),varargin{:}) end function setRidgeLine(obj,n,varargin) set(obj.ridgeLineHdl(n),varargin{:}) end % 設定各個分位線屬性 function setMedLine(obj,n,varargin) set(obj.medLineHdl(n),varargin{:}) end function setQtLine(obj,n,varargin) set(obj.QtLineHdl(n),varargin{:}) end % 設定scatter屬性 function setScatter(obj,n,varargin) set(obj.scatterHdl(n),varargin{:}) end end % @author : slandarer % gzh : slandarer隨筆 % Zhaoxu Liu / slandarer (2023). joyplot % (https://www.mathworks.com/matlabcentral/fileexchange/125255-joyplot), % MATLAB Central File Exchange. 檢索來源 2023/2/23. end
file exchange連結:Zhaoxu Liu / slandarer (2023). joyplot (https://www.mathworks.com/matlabcentral/fileexchange/125255-joyplot), MATLAB Central File Exchange. 檢索來源 2023/2/23.
以上就是Matlab繪製花裡胡哨的山脊圖的詳細內容,更多關於Matlab山脊圖的資料請關注it145.com其它相關文章!
相關文章
<em>Mac</em>Book项目 2009年学校开始实施<em>Mac</em>Book项目,所有师生配备一本<em>Mac</em>Book,并同步更新了校园无线网络。学校每周进行电脑技术更新,每月发送技术支持资料,极大改变了教学及学习方式。因此2011
2021-06-01 09:32:01
综合看Anker超能充系列的性价比很高,并且与不仅和iPhone12/苹果<em>Mac</em>Book很配,而且适合多设备充电需求的日常使用或差旅场景,不管是安卓还是Switch同样也能用得上它,希望这次分享能给准备购入充电器的小伙伴们有所
2021-06-01 09:31:42
除了L4WUDU与吴亦凡已经多次共事,成为了明面上的厂牌成员,吴亦凡还曾带领20XXCLUB全队参加2020年的一场音乐节,这也是20XXCLUB首次全员合照,王嗣尧Turbo、陈彦希Regi、<em>Mac</em> Ova Seas、林渝植等人全部出场。然而让
2021-06-01 09:31:34
目前应用IPFS的机构:1 谷歌<em>浏览器</em>支持IPFS分布式协议 2 万维网 (历史档案博物馆)数据库 3 火狐<em>浏览器</em>支持 IPFS分布式协议 4 EOS 等数字货币数据存储 5 美国国会图书馆,历史资料永久保存在 IPFS 6 加
2021-06-01 09:31:24
开拓者的车机是兼容苹果和<em>安卓</em>,虽然我不怎么用,但确实兼顾了我家人的很多需求:副驾的门板还配有解锁开关,有的时候老婆开车,下车的时候偶尔会忘记解锁,我在副驾驶可以自己开门:第二排设计很好,不仅配置了一个很大的
2021-06-01 09:30:48
不仅是<em>安卓</em>手机,苹果手机的降价力度也是前所未有了,iPhone12也“跳水价”了,发布价是6799元,如今已经跌至5308元,降价幅度超过1400元,最新定价确认了。iPhone12是苹果首款5G手机,同时也是全球首款5nm芯片的智能机,它
2021-06-01 09:30:45