How to fix black figure error?
16 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Keegan Carvalho
el 4 de Feb. de 2019
Comentada: Star Strider
el 5 de Feb. de 2019
I have attached a zipped netcdf file named 'trial'. I wanted to plot a variable 'sst' on the map; the data is downloaded for the arctic ocean i.e. 70-90N and 0-360E.
However I am getting a black figure when tyring to plot the average of 'sst' variable. I have used the following code and get the image (attached).
lon=ncread('trial.nc','longitude');
lat=ncread('trial.nc','latitude');
sst=ncread('trial.nc','sst');
iwant=mean(sst,3);
pcolor(lon,lat,iwant')
colorbar
drawnow
I would like some assistance in the matter of the black figure.
I believe the above map is created based on the cartesian coordiantes. Would be grateful to receive some help in creating a polar map.
0 comentarios
Respuesta aceptada
Star Strider
el 4 de Feb. de 2019
Editada: Star Strider
el 4 de Feb. de 2019
There are other options as well, such as surf, mesh, and contourf. The Mapping Toolbox (that I don’t have) may also have functions that could be more appropriate.
EDIT —
Your data sizes are not appropriate with respect to converting them to Cartesian ⇔ polar coordinates. Search the Mapping Toolbox for an appropriate function.
2 comentarios
Star Strider
el 5 de Feb. de 2019
The ‘data size’ referred to my attempting to convert it to polar coordinates using pol2cart. Since it appears to be centred around 90°S, I thought that might work, since I have used a similar approach in other plotting problems. (Perhaps I simply do not understand your data.)
I would also see if the contourf function will work with your data. You can set the number of contours, and tweak it to do what you want.
Más respuestas (1)
Steven Lord
el 4 de Feb. de 2019
You have a lot of individual squares in the "checkerboard" being displayed. What you're seeing are all the edges between the squares. If you change the color of the edges to 'none' you'll be able to see the underlying data. First view some sample data with the edges. You won't be able to see the underlying surface.
z = peaks(1000);
h = pcolor(z); % All black
Now turn off the edge color so you can see the details of the peaks surface data.
h.EdgeColor = 'none'; % Colorful
Alternately you might want to use the shading function to change the shading from the default 'faceted' to 'flat' or 'interp'. Not only will this have an effect on the edges but it will also affect how the color of each cell is selected. See the documentation page for pcolor and shading for more information.
0 comentarios
Ver también
Categorías
Más información sobre Map Display en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!