Colour Jet figure plot - how to view exact value?
2 views (last 30 days)
Show older comments
I have been following code from a textbook which creates the following plot for fluid pressure in the earths crust. It is good to be able to see the general distribution of pressure. My question is, if I wanted to know the precise pressure at a specific point, rather than approximating based on the colour, where would I be able to find such data? It is hard to precisely equate the colour chart to an exact value especially when one is colourblind. For example, say I wanted to know if the exact pressure at (25km, -10km) is 61Mpa or 63Mpa.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/274092/image.png)
The code that creates the plot is shown below.
% plot Excess fluid pressure with Darcy flow vectors
figure(2)
um = mean(u); % um is the mean (average) velocity at the integration point for each element
vm = mean(v);
um(find(phase==2))=0; % zero velocites in fault to focus on flow row of "t" from pdemesh (4th row of t matrix)
vm(find(phase==2))=0; % in the surrounding crust INKS TO PHASE ROW OF "t" from pdemesh
pdeplot(g_coord/1e3,edge,g_num_plot,'xydata',displ/1e6,'mesh','off','contour','on');
hold on
pdeplot(g_coord/1e3,edge,g_num,'flowdata',[um' vm'],'mesh','off','contour','off');
title(['Excess fluid pressure (MPa) after ',num2str(time/seconds_per_yr),' years'])
xlabel('Distance(km)' )
ylabel('Depth(km)' )
colormap('jet') % jet is the colour map of the plotted figure. Jet is a 3 column array which has the
% same numer of rows as the current figure. Each array row has red, green,
% blue (rgb) intensities for a specific colour
axis equal
drawnow
Thank you kindly
1 Comment
Adam Danz
on 27 Feb 2020
Edited: Adam Danz
on 27 Feb 2020
An ideal solution would be to alter the datatips by adding an additional row that reports the color scale value.
But due to what seems to be a bug, an illogical error prevents applying these changes to datatips on patch objects.
The could would look like this (but again, a bug will cause an error at the end)
% get handle
h = pdeplot(. . .);
% Extract patch handle (assuming only 1)
patchHandle = findobj(h, 'type','patch');
% Create a datatip
% This is required in order to activate the DataTipTemplate
dcmh = datacursormode(gcf());
dTip = createDatatip(dcmh,patchHandle);
row = dataTipTextRow('C','CData');
patchHandle.DataTipTemplate.DataTipRows(end+1) = row; % ERROR
Answers (1)
Ravi Kumar
on 27 Feb 2020
If you got the solution, displ, u, and v by setting up and solving the PDEs in PDE Toolbox, then you would be able to use interpolateSolution function get the value at your desired location. That is, did you call solvepde function? If so then the output would be a object containing results data and methods that can be used on the results.
0 Comments
See Also
Categories
Find more on Geometry and Mesh 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!