I am trying to plot data with the following format:
lat, lon, data
as a scatter plot.
The variable "data" is numerical, has 5 categories, coded 20 to 100 (in increments of 20). What I wish is to simply obtain a scatter, with only 5 colours displayed, along with the below mentioned categories for each colour. It does not however appear to be functioning as I wish to. For instance, for the data:
lat: 79.0007000000000 79.0174000000000 78.7839000000000 80.0776000000000 78.4726000000000 80.7917000000000 78.2202000000000 78.1410000000000 91.9899000000000 91.0077000000000 92.5938000000000 92.8377000000000 91.4009000000000 95.6243000000000 87.9044000000000
lon: 19.2348000000000 13.4618000000000 14.4619000000000 16.2910000000000 17.3825000000000 16.5791000000000 17.8726000000000 18.5054000000000 27.6548000000000 26.4381000000000 24.4822000000000 26.2138000000000 26.5146000000000 27.5701000000000 26.2984000000000
data:
40 60 60 40 20 60 40 60 40 60 20 20 80 80 80
I now attempt:
scatter(lat,lon,data,data,'filled')
colorbar('YTickLabel',{'<-0.5','-0.5 to 0','0 to 0.5','0.5 to1','No Data'})
Evidently, this does not produce what I desire. I then attempt to set only 5 colours, as below:
scatter(lat,lon,data,data,'filled')
colormap(jet(5))
colorbar('YTickLabel',{'<-0.5','-0.5 to 0','0 to 0.5','0.5 to1','No Data'})
This still does not solve the problem, since I now have only 5 colours, but still have twice the number of labels, since the number of "YTicks" are still 10, as opposed to the 5 that I want.
My question really is: In this case, should I attempt to set "caxis" instead of working directly with the "colorbar" function, and if so, how could I set "caxis" such that I have exactly 5 categories on "YTick" ?
|