How to change the size of heatmap axis labels

3 ビュー (過去 30 日間)
EL
EL 2019 年 11 月 18 日
Hello,
I'm trying to change the size of the axis labels on a heatmap, however the size the the axis labels and the tick labels remain are the same. When I change one, the other changes with it, as well as the color bar labels on the right.
I've spent a few hours looking into this but I can't find a solution. I've tried remaking the graphs using 'HeatMap', which appears to be an older version of 'heatmap', but it doesn't have the modifications I need and the results of them just look worse.
In this case of this heatmap, I'm trying to make the tick labels a size 4 font, with the axis labels a size 14.
Attached is an example file I've been using. The script is setup so that you just drag the file to your desktop to load. All you have to do is edit your user name on line 7
%% Making Heatmaps
clear
clc
% Selecting file to save, and generating file path to save
VarData=load('C:\Users\USERNAME\Desktop\ExampleFile.txt');
% prompt = 'How many hours of Dead Data? ';
% DeadDataTime = input(prompt);
DeadDataTime=4;
%% HeatMaps with all Data included
% Making 5 minute bins
% 1°PolyFit Graphs\
HMBox5=reshape(VarData, [60,((length(VarData))/60)]);
% Box5old=reshape(VarData, [60,((length(VarData))/60)]);
HMBox5=HMBox5(:);
Livebin5min=reshape(HMBox5(1:(length(HMBox5)-(DeadDataTime*12*60))), 60, []);
Deadbin5min=reshape(HMBox5(1+((length(HMBox5))-(DeadDataTime*12*60)):length(HMBox5)), 60, []);
% Generating X Axis
XaxisHourCounter=0;
Xaxis=string(1:1:((length(HMBox5)-(DeadDataTime*12*60))/60));
for i=1:length(Xaxis);
count_i=num2str(round(XaxisHourCounter, 2), '%4.2f');
count_f=num2str(round(XaxisHourCounter+(1/12), 2), '%4.2f');
XaxisNum=strcat(count_i, '-', count_f);
Xaxis(i)=(XaxisNum);
XaxisHourCounter=XaxisHourCounter+(1/12);
end
% Generating Y Axis
YaxisHourCounter=((((length(HMBox5))-(DeadDataTime*12*60))/60)/12);
Yaxis=string((((length(HMBox5))-(DeadDataTime*12*60))/60):1:((length(HMBox5)/60))-1);
for i=1:length(Yaxis);
count_i=num2str(round(YaxisHourCounter, 2), '%4.2f');
count_f=num2str(round(YaxisHourCounter+(1/12), 2), '%4.2f');
YaxisNum=strcat(count_i, '-', count_f);
Yaxis(i)=(YaxisNum);
YaxisHourCounter=YaxisHourCounter+(1/12);
end
% Creating X and Y labels
% Alocattign space for Table
Tmatrix=zeros((DeadDataTime*12),(((length(HMBox5))-(DeadDataTime*12*60))/60));
% Filling Table
for Deadi=1:(DeadDataTime*12);
for Livei=1:(((length(HMBox5))-(DeadDataTime*12*60))/60);
LiveCol=Livebin5min(:,Livei);
DeadCol=Deadbin5min(:,Deadi);
[h, p]=ttest(DeadCol, LiveCol);
Tmatrix(Deadi, Livei)=p;
end
end
% Saving P-Value data in Table format. Not too much effort put into this.
% MIssing X-axis, but lines up with heatmap. Use heatmap as reference for
% layout. Saved in Tab-Deliminate format.
% writematrix(Tmatrix, strcat(HeatmapPathSave, '\', '5minbin10dsMatrix'), 'Delimiter','tab');
% Removing P Values.
Tmatrix(Tmatrix >= 0.05) = NaN;
% Import Table to heatmap
H=heatmap(Xaxis, Yaxis, Tmatrix, 'Colormap', parula(20), 'MissingDataColor', 'w', 'MissingDataLabel','P > 0.05', 'ColorScaling', 'log', 'YLabel', 'Dead Data', 'FontSize', 4, 'XLabel', 'Live Data');
caxis([ log(0.00001) log(0.05)]);
ax = gca;
% ax.FontSize = 4;
x0=10;
y0=10;
width=2000;
height=38.6363+((DeadDataTime/3)*261.3636); %These weird numbers are chosen for the length of the X Label which is fixed (77.27), while the chart is variable (222.72). Normalized using 300 as a baseline.
set(gcf,'position',[x0,y0,width,height]);

回答 (0 件)

カテゴリ

Help Center および File ExchangeData Distribution Plots についてさらに検索

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by