How to plot 2D density plot with very large files?
37 vues (au cours des 30 derniers jours)
Vikash Raj le 19 Fév 2023
I want to plot 2D density plots with a colourbar for very large files. I want my x ais to be longitude, y axis to be latitude and the z axis as absolute VTEC as colour bar. I was trying to run the codes given below but I getting a error. as
"Error using repmat
Requested 373471x373471 (1039.2GB) array exceeds maximum array size preference (15.9GB). This might cause MATLAB to become unresponsive.
Error in meshgrid (line 61)
xx = repmat(xrow,size(ycol));"
Any suggestions on how can I fix this so that I can obtain my dentsity contour plots ?
Im attaching my part of data. Is it possible for the graph to have blue colour as background colour as shown with the figure attached.
yi = Latitude;
[X,Y] = meshgrid(xi,yi);
Z = Absolute_VTEC;
Walter Roberson le 19 Fév 2023
Modifié(e) : Walter Roberson le 19 Fév 2023
You do not have a grid of lat and long: you have scattered data. You can see from the ratio of the number of unique elements to the number of stored elements that it does not happen to be a grid of data that has been reshaped into a row.
A density plot reflects how dense points are, and takes as input vectors of x and vectors of y -- no third value. You cannot do a density plot of scattered data when you have three variables. You can do things like take means.
scatter(Longitude, Latitude, 1, Absolute_VTEC)
mask = isfinite(Latitude) & isfinite(Longitude);
Latitude = Latitude(mask); Longitude = Longitude(mask);
N = 100;
[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';