How to reproduce axis labeling for given bar3 plot
1 view (last 30 days)
Show older comments
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]
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])
ylabel('ylabel')
xlabel('xlabel')
title('title')
0 Comments
Accepted Answer
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')
0 Comments
More Answers (0)
See Also
Categories
Find more on Annotations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!