How do I change my graph output from the standard Cartesian look to one that resembles a map?

4 views (last 30 days)
I am plotting multiple data points of temperature for different depths of Mars' mantle layers. One graph should look like the following:
This was the graph given to me and I had to create code to replicate this kind of graph, but this is what I'm getting in terms of look.
How do I turn this above graph into the appropriate shape? The difficult part I keep running into is that I am not working with geographical data necessarily. If you see my files/code, I am just looping through lots of numbers to graph the right coordinate points, so utilizing the mapping toolbox hasn't been really compatible with my work/data. I could be using it wrong, but I am just trying to figure out how I can get the above graph to be blue to white to red in terms of coloring, with higher values/redder colors correlating with hotter temperatures and for the graph itself to be shaped into that map shape of the first figure. I need to understand this to complete my research analysis, so please any advice would be helpful! I have been stuck on this for too many days/weeks.
Also, how can I make the color bar range from 0 to 1 instead of just picking the smallest and highest values from my data?
Here is the plotting code snippet:
%% Plot the points for every file for the fixed depth
figure
dataPoints = horzcat(finalLong,finalLat,temp);
x = finalLong(:,1); % Plot longitude (phi & second column) on x-axis
y = finalLat(:,1); % Plot latitude (theta & first column) on y-axis
z = temp(:,1); %plot temperatures
hold on
pointsize = 10;
scatter(x, y, pointsize, z)
colorbar('southoutside');

Answers (1)

R
R on 28 Mar 2024 at 9:36
Hi Ritisha,
To change the colours in the plot, you can utilize 'colormap'. You can create a custom colormap programatically or by using the Colormap Editor by refering to the following documentation:
Additionally, to change the range of the colorbar, refer to the 'TickLabels' property of the colorbar:

Categories

Find more on Geographic Plots 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!