Clear Filters
Clear Filters

How to reproduce axis labeling for given bar3 plot

4 views (last 30 days)
Hello,
I am seeking to reproduce the axis labels for the plot given below using an arbitrary 5x18 dataset.
I'll include the specific data that I am attempting this with below, along with the plot that I have already successfully genereated. I cannot seem to reproduce the labeling however, and I believe this needs to be done using categorical variables of some sort.
log4=[0.769651681808561,0.00850658785134913,0.00264356326264210,-0.00202871267443307,-0.00288250568612709,-0.00158627685456558,0.175621100303744,0.00349648750426491,8.06534415546791e-05,0.0656400469796460,0.00861326303417683,0.0607714995040300,-0.0617102702264314,0.00103361565488362,0.0223632319074827,-0.00269997250815763,-0.00144347355991724,0.0144542212562541]
log4 = 1×18
0.7697 0.0085 0.0026 -0.0020 -0.0029 -0.0016 0.1756 0.0035 0.0001 0.0656 0.0086 0.0608 -0.0617 0.0010 0.0224 -0.0027 -0.0014 0.0145
log5=[0.851075023910076,0.00900091640621212,-0.000893714196693985,-0.000179800836847536,0.00217888391815531,-0.00165227522820576,0.466203412439180,0.00513511837176129,0.000558864250324296,0.0582962831176469,0.0122388532166498,0.0484036344795410,-0.0437656824434971,0.000109040671932745,0.00215158881422960,0.000986408359390383,0.000144774766365774,-0.00143145699319160]
log5 = 1×18
0.8511 0.0090 -0.0009 -0.0002 0.0022 -0.0017 0.4662 0.0051 0.0006 0.0583 0.0122 0.0484 -0.0438 0.0001 0.0022 0.0010 0.0001 -0.0014
log6=[0.869538304111863,0.00877627771699362,0.00377414648185417,-0.00111864918321900,-0.00137857591075606,-0.00335433765660384,0.732135881323300,0.0167623428871126,-0.000679861785357147,0.0654550510763672,0.0118954102758765,0.0390580690159797,-0.0366181560057798,0.00102642468120866,0.00291856865772008,-0.000971249404420461,-0.000900238912683263,-0.00393280016702243]
log6 = 1×18
0.8695 0.0088 0.0038 -0.0011 -0.0014 -0.0034 0.7321 0.0168 -0.0007 0.0655 0.0119 0.0391 -0.0366 0.0010 0.0029 -0.0010 -0.0009 -0.0039
log7=[0.751336062791431,-0.00545942794258248,0.00255593761832977,0.00363711340095949,-0.00174670671806989,-0.00294434753767163,0.868840339375595,0.0390672391388814,-0.00142711594528131,0.101362004001923,0.0162724665949601,0.0526615262482676,-0.0488026077405930,0.000605170900601247,0.000131875287610537,-0.00255147498596578,-0.00375911015378937,-0.00124147662234437]
log7 = 1×18
0.7513 -0.0055 0.0026 0.0036 -0.0017 -0.0029 0.8688 0.0391 -0.0014 0.1014 0.0163 0.0527 -0.0488 0.0006 0.0001 -0.0026 -0.0038 -0.0012
log8=[0.466600575183528,-0.0731143693411919,0.00254519851654253,0.00208341493773410,0.000308704293125124,-0.000218941697949199,0.982975987984264,0.134978387375471,-9.70050673232324e-05,0.287520499160209,0.0319247615693954,0.0989435323097224,-0.0934322800603541,0.00158903929528774,0.00181088163289232,-0.000956150160536712,0.000469850736978185,0.00139341323874884]
log8 = 1×18
0.4666 -0.0731 0.0025 0.0021 0.0003 -0.0002 0.9830 0.1350 -0.0001 0.2875 0.0319 0.0989 -0.0934 0.0016 0.0018 -0.0010 0.0005 0.0014
z=[log4;log5;log6;log7;log8]
z = 5×18
0.7697 0.0085 0.0026 -0.0020 -0.0029 -0.0016 0.1756 0.0035 0.0001 0.0656 0.0086 0.0608 -0.0617 0.0010 0.0224 -0.0027 -0.0014 0.0145 0.8511 0.0090 -0.0009 -0.0002 0.0022 -0.0017 0.4662 0.0051 0.0006 0.0583 0.0122 0.0484 -0.0438 0.0001 0.0022 0.0010 0.0001 -0.0014 0.8695 0.0088 0.0038 -0.0011 -0.0014 -0.0034 0.7321 0.0168 -0.0007 0.0655 0.0119 0.0391 -0.0366 0.0010 0.0029 -0.0010 -0.0009 -0.0039 0.7513 -0.0055 0.0026 0.0036 -0.0017 -0.0029 0.8688 0.0391 -0.0014 0.1014 0.0163 0.0527 -0.0488 0.0006 0.0001 -0.0026 -0.0038 -0.0012 0.4666 -0.0731 0.0025 0.0021 0.0003 -0.0002 0.9830 0.1350 -0.0001 0.2875 0.0319 0.0989 -0.0934 0.0016 0.0018 -0.0010 0.0005 0.0014
z=abs(z)
z = 5×18
0.7697 0.0085 0.0026 0.0020 0.0029 0.0016 0.1756 0.0035 0.0001 0.0656 0.0086 0.0608 0.0617 0.0010 0.0224 0.0027 0.0014 0.0145 0.8511 0.0090 0.0009 0.0002 0.0022 0.0017 0.4662 0.0051 0.0006 0.0583 0.0122 0.0484 0.0438 0.0001 0.0022 0.0010 0.0001 0.0014 0.8695 0.0088 0.0038 0.0011 0.0014 0.0034 0.7321 0.0168 0.0007 0.0655 0.0119 0.0391 0.0366 0.0010 0.0029 0.0010 0.0009 0.0039 0.7513 0.0055 0.0026 0.0036 0.0017 0.0029 0.8688 0.0391 0.0014 0.1014 0.0163 0.0527 0.0488 0.0006 0.0001 0.0026 0.0038 0.0012 0.4666 0.0731 0.0025 0.0021 0.0003 0.0002 0.9830 0.1350 0.0001 0.2875 0.0319 0.0989 0.0934 0.0016 0.0018 0.0010 0.0005 0.0014
bar3(z)
zlim([0 1])
ylabel('ylabel')
xlabel('xlabel')
title('title')

Accepted Answer

Voss
Voss on 2 Oct 2023
Edited: Voss on 2 Oct 2023
Something like this:
log4=[0.769651681808561,0.00850658785134913,0.00264356326264210,-0.00202871267443307,-0.00288250568612709,-0.00158627685456558,0.175621100303744,0.00349648750426491,8.06534415546791e-05,0.0656400469796460,0.00861326303417683,0.0607714995040300,-0.0617102702264314,0.00103361565488362,0.0223632319074827,-0.00269997250815763,-0.00144347355991724,0.0144542212562541];
log5=[0.851075023910076,0.00900091640621212,-0.000893714196693985,-0.000179800836847536,0.00217888391815531,-0.00165227522820576,0.466203412439180,0.00513511837176129,0.000558864250324296,0.0582962831176469,0.0122388532166498,0.0484036344795410,-0.0437656824434971,0.000109040671932745,0.00215158881422960,0.000986408359390383,0.000144774766365774,-0.00143145699319160];
log6=[0.869538304111863,0.00877627771699362,0.00377414648185417,-0.00111864918321900,-0.00137857591075606,-0.00335433765660384,0.732135881323300,0.0167623428871126,-0.000679861785357147,0.0654550510763672,0.0118954102758765,0.0390580690159797,-0.0366181560057798,0.00102642468120866,0.00291856865772008,-0.000971249404420461,-0.000900238912683263,-0.00393280016702243];
log7=[0.751336062791431,-0.00545942794258248,0.00255593761832977,0.00363711340095949,-0.00174670671806989,-0.00294434753767163,0.868840339375595,0.0390672391388814,-0.00142711594528131,0.101362004001923,0.0162724665949601,0.0526615262482676,-0.0488026077405930,0.000605170900601247,0.000131875287610537,-0.00255147498596578,-0.00375911015378937,-0.00124147662234437];
log8=[0.466600575183528,-0.0731143693411919,0.00254519851654253,0.00208341493773410,0.000308704293125124,-0.000218941697949199,0.982975987984264,0.134978387375471,-9.70050673232324e-05,0.287520499160209,0.0319247615693954,0.0989435323097224,-0.0934322800603541,0.00158903929528774,0.00181088163289232,-0.000956150160536712,0.000469850736978185,0.00139341323874884];
z=[log4;log5;log6;log7;log8];
z=abs(z);
bar3(z)
zlim([0 1])
% set axes ticks and tick labels:
set(gca(), ...
'XTick',1:18, ...
'XTickLabel',["\Gamma","c","M","k","f","\gamma"] + "_" + (1:3).', ...
'YTick',1:5, ...
'YTickLabel',compose('10^%d',4:8));
% (optional) set y-axis direction normal to match the reference image:
set(gca(),'YDir','normal');
% (optional) orient plot like in the reference image:
view([50 25]);
ylabel('ylabel')
xlabel('xlabel')
title('title')

More Answers (0)

Products


Release

R2023b

Community Treasure Hunt

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

Start Hunting!