Deleting overlapping lines in a plot

3 ビュー (過去 30 日間)
Hans Sunaryanto
Hans Sunaryanto 2019 年 8 月 19 日
コメント済み: Chris 2019 年 8 月 23 日
Hi all,
I have a .fig file that is made up of red and black lines and I want to be able to export this as .pdf. Plot twist: Each of the red lines shown here has an underlying black line that I want to just get rid of, so it results in only purely-black and purely-red lines. Any idea how to solve this?
Thanks!
  1 件のコメント
darova
darova 2019 年 8 月 19 日
Do you have a source where those curves come from? A script?

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

採用された回答

Chris
Chris 2019 年 8 月 19 日
.fig files retain Children information of the figure; you can loop over the Children and delete based on color.
  5 件のコメント
Hans Sunaryanto
Hans Sunaryanto 2019 年 8 月 22 日
Hi Chris,
The function you gave me would delete all of the black lines I have in my figure. This isn't exactly what I was looking for, since I want to only delete the black lines that are precisely located under the red ones. Do you have any idea how we can incorporate this function (or another function) to solve it?
Thanks!
Chris
Chris 2019 年 8 月 23 日
You will need to then loop over all combinations of red and black lines testing for pairs.
The pair test: If the end points of the overlapping lines are coincident you can do a distance test on each end. Else you can try using polyfit to determine if the two lines have the same slope and y-intercept.
Or if you have a small number of plots and lines you can loop over each black line, make the line a new color and used input() to specify if that line should be deleted; if not restore its color

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

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by