How to cut out part of x axis in scatter plot ?
Show older comments
Hi,
I have have used scatter plots to plot Lattitude on x axis, Longitude on y axis and Absolute VTEC on Z axis.Typically my data is on both side of 180 deg. The longitudinal values are form -130 to -180 deg in West side while 180 to 130 deg in East side. When I plot the graph the longitudal values are displayed form -180 to 180 and my the graphs are seperated by showing large gaps in the x axis.
First I want to remove the part of this axis which dosent have graphs.
Secondly I wish bring the graph together at 180 deg and the x axis to be labled as
+130, .....+150 +160, +170, 180, -170 , -160, -150..........-130
Any suggestions will be highly appriciated.
Im attaching the codes that I used to obtain the graph.
mask = isfinite(Latitude) & isfinite(Longitude);
Latitude = Latitude(mask); Longitude = Longitude(mask);
N = 80;
[latbins, latedges] = discretize(Latitude, N);
[lonbins, lonedges] = discretize(Longitude, N+1);
denmat = accumarray([latbins(:), lonbins(:)], Absolute_VTEC(mask), [], @mean, NaN);
latmid = (latedges(1:end-1) + latedges(2:end))/2;

lonmid = (lonedges(1:end-1) + lonedges(2:end))/2;
h = pcolor(lonmid, latmid, denmat);
h.EdgeColor = 'none';
colorbar ()
colormap jet
ax = gca;
ax.LineWidth = 2;
ylim([-30 30]);
h = colorbar;
set(get(h,'label'),'string','VTEC');
ylabel('Latitude [Deg]','fontweight','bold','FontSize',12)
xlabel('Longitude [Deg]','fontweight','bold','FontSize',12)
title('$October$ $2016$','Interpreter','LaTex','FontSize',16)
4 Comments
"Im attaching the codes that I used to obtain the graph. "
mask = isfinite(Latitude) & isfinite(Longitude);
Latitude = Latitude(mask); Longitude = Longitude(mask);
N = 80;
[latbins, latedges] = discretize(Latitude, N);
[lonbins, lonedges] = discretize(Longitude, N+1);
denmat = accumarray([latbins(:), lonbins(:)], Absolute_VTEC(mask), [], @mean, NaN);
latmid = (latedges(1:end-1) + latedges(2:end))/2;
Apparently not so, or at least not enough for us to run the code snippet that you supplied. Please give working code and data.
If you have any more questions, then attach your data and code to read it in with the paperclip icon after you read this:
Vikash Raj
on 22 Feb 2023
Dyuman Joshi
on 22 Feb 2023
The file is empty.
Vikash Raj
on 22 Feb 2023
Accepted Answer
More Answers (0)
Categories
Find more on Axis Labels 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!




