- Use the contour or contourf function to create the contour plot of your data.
- To add lines to the contour plot, you can use the hold on command to enable multiple plot overlays. Then, use the plot function to draw the desired lines. (do this for each line)
adding lines to a contour plot with labels
60 ビュー (過去 30 日間)
古いコメントを表示
I want to produce something like this
But I'm not sure how- how might one add lines and labels to contor plots?
1 件のコメント
Aakash
2023 年 7 月 5 日
Hi,
What I understand from your question is that you want to add line plots in a contour plot, for that:
for example:
hold on;
x_line = [x1, x2]; % x-coordinates of the line endpoints
y_line = [y1, y2]; % y-coordinates of the line endpoints
plot(x_line, y_line, '--');
3. To add labels to the contour plot, you can use the text function to place text at specific coordinates on the plot.
for example:
x_label = x_coordinate; % x-coordinate of the label
y_label = y_coordinate; % y-coordinate of the label
label_text = 'a'; % Text for the label
text(x_label, y_label, label_text, 'FontSize', 12, 'Color', 'black');
回答 (1 件)
KALYAN ACHARJYA
2023 年 7 月 5 日
編集済み: KALYAN ACHARJYA
2023 年 7 月 5 日
x1 = -10:0;
y1=10:-1:0;
x2 = 0:10;
y2=0:10;
x3=zeros*(0:10);
y3=0:10;
plot(x1,y1,x2,y2,x3,y3,'--');
text(x1(round(length(x1)/2)),y1(round(length(y1)/2))+1,'a');
text(x2(round(length(x2)/2)),y2(round(length(y2)/2))+1,'c');
text(x3(round(length(x3)/2)),y3(round(length(y3)/2))+1,'b');
You can also create the corresponding function equation as per requirement since it have simple linear relationship.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Contour Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!