필터 지우기
필터 지우기

separate y axis on right and left (even and odd data) with IMAGESC

조회 수: 2 (최근 30일)
Hello,
I have a matrix containing some data that I want to plot with imagesc. I want to separate rows representation on y axis (even rows on right and odd on left), in a way that they don't overlap themselves.
The code i was trying is this:
figure(12);
yyaxis left
ylabel('Odd Side');
imagesc(RateR_new.Flux(1:2:end,1));
yticklabels = 1:2:32;
yticks = linspace(1, size(RateR_new.Flux(1:2:end,1), 1), numel(yticklabels));
set(gca, 'XTick',xticks, 'XTickLabel', xlabels);
set(gca, 'YTick', yticks, 'YTickLabel', flipud(yticklabels(:)));
yyaxis right;
ylabel('Even Side');
im = imagesc(RateR_new.Flux(2:2:end,1));
yticklabels1 = 2:2:32;
yticks1 = linspace(1, size(RateR_new.Flux(2:2:end,1), 1), numel(yticklabels1));
set(gca, 'YTick', yticks1, 'YTickLabel', flipud(yticklabels1(:)));
But in this case i have even and odd data overlap themselves.
Hope to someone that can help me. Thanks in advance!

채택된 답변

埃博拉酱
埃博拉酱 2023년 4월 3일
편집: 埃博拉酱 2023년 4월 7일
Preprocess your data like:
reshape(RateR_new.Flux(:,1),2,[])'
Not sure if this is what you want. If not, it's best to draw a diagram of what exactly you want to do.
Update 20230407
If you want to share a graph with two different Y-axes, you can do this:
Data=rand(30);
figure;
yyaxis left
imagesc(Data);
yticks(1:2:30);
yyaxis right
axis ij
ylim([0.5,30.5]);
yticks(2:2:30);
If the data is also separated, you may use tiledlayout:
DataO=Data(1:2:end,:);
DataE=Data(2:2:end,:);
figure;
tiledlayout(1,2,TileSpacing='none',Padding='tight');
nexttile;
imagesc(DataO,YData=[1,29]);
yticks(1:2:30);
Ax=nexttile;
imagesc(DataE,YData=[2,30]);
Ax.YAxisLocation='right';
yticks(2:2:30);
  댓글 수: 3
Image Analyst
Image Analyst 2023년 4월 7일
If you have any more questions, then attach your data (RateR_new.Flux) and code to read it in with the paperclip icon after you read this:
Jessica Frau
Jessica Frau 2023년 4월 9일
it solved my problem. Thank u very much!!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Axis Labels에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by