How to fixed the axis order in hist3 plot?
1 次查看(过去 30 天)
显示 更早的评论
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.
0 个评论
采纳的回答
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 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Annotations 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!