필터 지우기
필터 지우기

How to fixed the axis order in hist3 plot?

조회 수: 3 (최근 30일)
Andi
Andi 2022년 6월 4일
답변: Star Strider 2022년 6월 4일
Hi everyone,
My script works well but there is only one issue, it gives vertical axis as reverse (higher to lower (46 to 45 instead of 45 to 46: Figure attached)
clear all
clc
axial_cat=readmatrix('axil_cat.csv'); % Axil catalog
axial_lat=axial_cat(:,7);
axial_long=-1*axial_cat(:,8);
data=[axial_long axial_lat];
figure;
resolution = [50, 50]; % This defines the how many bins you want 1000mm/10 = 100mm bin size
[n, q] = hist3(data, resolution);
imagesc(q{:}, n');
xlabel('length [mm]');
ylabel('length [mm]');
c = colorbar;
c.Label.String = 'Amount';
set(gca,'ColorScale','log')
Problem 2: I attempt to solve this issue with another approch. Altough the axis issues is solved by second approch but resolution is limited like 10 by 10, where i need 50 by 50;
My attempt is as below:
figure;
hist3(F,'CdataMode','auto')
xlabel('Longitude (W{\circ})')
ylabel('Latitude (N{\circ})')
xlim([-130.05 -129.95])
ylim([45.9 46])
yticks(45.9:0.05:46);
% ax=gca
% ax.yTick = 45.9:2:46;
colorbar
set(gca,'ColorScale','log')
a = colorbar;
a.Label.String = 'Event count';
view(2)
figure shows 10 by 10 resolution, how can i increase resolution in second case.

채택된 답변

Star Strider
Star Strider 2022년 6월 4일
The problem may be using imagesc.
Try
set(gca, 'YDir','normal')
x = randn(100,1);
y = randn(100,1);
data = [x y];
figure;
resolution = [50, 50]; % This defines the how many bins you want 1000mm/10 = 100mm bin size
[n, q] = hist3(data, resolution);
imagesc(q{:}, n');
figure;
resolution = [50, 50]; % This defines the how many bins you want 1000mm/10 = 100mm bin size
[n, q] = hist3(data, resolution);
imagesc(q{:}, n')
set(gca, 'YDir','normal')
.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Graphics Object Programming에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by