Use the same scale for multiple geodensityplots.

2 views (last 30 days)
I'm coding a program to show how solar irradiance varies throughout the year (it's monthly based), so I need to create 12 graphs, each showing the solar irradiance in that specific month. I want the color scheme to vary throughout the year using the same scale in all the graphs, so color can be visually representative, and the viewer can compare the graphs just by looking at them. To sum it up, they all should look like heatmaps with the same scale.
My data structure is a table of 80x14. The first two columns are global coordinates (latitude and longitude), the next 12 columns are the monthly values of solar irradiance. Rows represent irradiance values per location coordinates.
This is the base structure of each plot
figure(1)
lat1 = [Heatmaps.Latitudphi];
lon1 = [Heatmaps.Longitudepsilon];
dp=geodensityplot(lat1,lon1,Heatmaps.Jan,'Radius',35e3)
geobasemap darkwater
colormap turbo
dp.FaceColor = 'interp';
Heatmaps.Jan is my data vector (I think it's called weight in the function argument), and Heatmaps is a table with the structure mentioned above. Plot(2) uses Heatmaps.Feb and so on.
I read somewhere in the forums that caxis might do the trick, but so far, I have not be able to make it work.

Answers (1)

mahmoud ayyad
mahmoud ayyad on 25 Sep 2022
Hello
caxis does the trick.
you have to do it manually. First of all, you have to identify the color range (minimum and maximum values) that you want all the 12 figures follow. Then after every plot, you have to specify the range manually. For example:
you know that the range should be from 0 to 1e-3. Then,
figure(1)
lat1 = [Heatmaps.Latitudphi];
lon1 = [Heatmaps.Longitudepsilon];
dp=geodensityplot(lat1,lon1,Heatmaps.Jan,'Radius',35e3)
geobasemap darkwater
colormap turbo
dp.FaceColor = 'interp';
caxis([0 1e-3]) % defining the pre-defined range
figure(2)
lat1 = [Heatmaps.Latitudphi];
lon1 = [Heatmaps.Longitudepsilon];
dp=geodensityplot(lat1,lon1,Heatmaps.Feb,'Radius',35e3)
geobasemap darkwater
colormap turbo
dp.FaceColor = 'interp';
caxis([0 1e-3]) % defining the pre-defined range
figure(3)
lat1 = [Heatmaps.Latitudphi];
lon1 = [Heatmaps.Longitudepsilon];
dp=geodensityplot(lat1,lon1,Heatmaps.Mar,'Radius',35e3)
geobasemap darkwater
colormap turbo
dp.FaceColor = 'interp';
caxis([0 1e-3]) % defining the pre-defined range
an so on for the 12 figures.
I hope that this will help you.

Categories

Find more on Colormaps in Help Center and File Exchange

Products


Release

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!