フィルターのクリア

Is it possible to connect 2 data sets while using the plot command?

2 ビュー (過去 30 日間)
Brad
Brad 2015 年 1 月 7 日
コメント済み: Brad 2015 年 1 月 7 日
I am using the following code to generate a 2-D line plots.
figure('Name','Event Altitude','numbertitle','off');
axes('Position', [0.04 0.07 1.16 0.884]);
h = plot(Pre_Time1, Pre_Density1, '-o', Post_Time1, Post_Density1, '-o', 'MarkerSize', 15);
set(h(1), 'Color', 'r', 'MarkerFaceColor', 'r');
set(h(2), 'Color', 'g', 'MarkerFaceColor', 'g');
title(Event_Title, 'Fontsize', 20, 'fontweight', 'b');
legend(Source1, 'Location', 'NortheastOutside');
set(legend, 'FontSize', 20);
set(gca, 'Fontsize', 16);
grid on;
box on;
Within these plots are 2 distinct sets of data – Pre_Density1 (Red) and Post_Density1 (Green).
In the plot below, each data set is plot separately with no lines between the 2 sets. Is there a way to connect the 2 data sets?
Thank you.

採用された回答

Image Analyst
Image Analyst 2015 年 1 月 7 日
What color line do you want between them? Let's say it's blue. Just make a new line segment where you stitch the endpoints of the other two lines together.
x = [Pre_Time1(end), Post_Time1(1)];
y = [Pre_Density1(end), Post_Density(1)]
plot(x, y, 'b-', 'LineWidth, 3);
  1 件のコメント
Brad
Brad 2015 年 1 月 7 日
Image Analyst, I placed a ' hold all' prior to this block of code and it runs like a champ. Super idea!! Thanks!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by