How do I specify a specific color for a specific value for velocity in seismic velocity modelling?
1 view (last 30 days)
Show older comments
Sumana Mondal
on 28 Jun 2021
Answered: Scott MacKenzie
on 30 Jun 2021
x=[-500 500 500 -500 -500];
y=[0 0 -20 -20 0];
fill(x,y,[0.3010 0.7450 0.9330]);
hold on;
y1=[-20 -20 -30 -30 -20];
fill(x,y1,[0.7010 0.7450 0.9330]);
y2=[-30 -30 -50 -50 -30];
fill(x,y2,[0.2010 0.7450 0.130]);
xlabel('Offset');
ylabel('Depth');
title('Velocity Model');
set(gca,'ydir','reverse');set(gca,'xaxislocation','top');
hold off
I have used this code and want to assign the valus of velocity 550 750 1000 for the rectangles respective and add a colorbar with the value of velocity
2 Comments
Scott MacKenzie
on 28 Jun 2021
Are you sure you want to add a colorbar? Perhaps you just want to add a text label (550, 750, or 1000) to each bar. Please clarify, if you can.
Accepted Answer
Scott MacKenzie
on 30 Jun 2021
I think this is more or less what you are after. The code includes an example of adding text and a rectangle. You can customize these as per your data and needs.
y = 180:10:340;
c = repmat(y',1,6);
p = pcolor(flip(c));
p.FaceColor = 'interp';
p.LineStyle = 'none';
colormap jet;
cb = colorbar;
cb.Label.String = 'S Velocity (m/s)';
ax = gca;
ax.YDir = 'reverse';
ax.XTickLabel = num2cell(10:10:60);
ax.YTickLabel = num2cell(1:8);
ax.XLabel.String = 'X (m)';
ax.YLabel.String = 'Z (m)';
% examples of adding text and rectangle
text(3.6, 8, 'Example text', 'horizontalalignment', 'center', 'fontsize', 18);
rectangle('position', [2 9 3 2]);
0 Comments
More Answers (0)
See Also
Categories
Find more on Purple 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!