How do I specify a specific color for a specific value for velocity in seismic velocity modelling?
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
Scott MacKenzie
2021-6-28
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.
采纳的回答
Scott MacKenzie
2021-6-30
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 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Purple 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!