Is it possible to extend a line which is plotted in one subplot to another subplot in same figure

6 ビュー (過去 30 日間)
I need to extend a line which I plot in subplot(2,1,1) to subplot(2,1,2). I have used hough transform to detect the lines in subplot(2,1,1), with the values of the lines (ie points), I am constructing a line which is needed to be extended to subplot(2,1,2)

回答 (1 件)

the cyclist
the cyclist 2016 年 2 月 27 日
編集済み: the cyclist 2016 年 2 月 27 日

Yes. You just need to turn off "clipping". Here is an example:

rng 'default'
figure
subplot(2,1,1), plot(rand(3,4).'.')
subplot(2,1,2), plot(rand(3,4).'.')
set(gca,'Clipping','Off')
h = line([1.4 2.6],[0.4 1.8]);
ylim([0 1])
set(h,'LineWidth',2)

A few things to note:

  • The line is plotted (in this example) in the coordinate system of the bottom subplot, because that is current axes when I create the line.
  • You can't specify the line with coordinates from both sets of axes (I believe)
  • I had to specify the ylim of the bottom subplot, so that it would not just automatically resize to accommodate the line.
  4 件のコメント
Junia Josephine D
Junia Josephine D 2016 年 2 月 28 日
Its okay. Thanks for the reply :)
Walter Roberson
Walter Roberson 2016 年 2 月 29 日
I am getting the clipped result in R2014a in OS-X.

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

カテゴリ

Help Center および File ExchangeSubplots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by