Unwanted items showing up in plot legend

2 ビュー (過去 30 日間)
Levi Brunelle
Levi Brunelle 2022 年 9 月 24 日
回答済み: Walter Roberson 2022 年 9 月 24 日
Hello, I am trying to add a legend for a graph that has several scatterplots with lines of best fit. I am trying to only display the scatterplot items on the legend, but for some reason it's adding in a bunch of random items. I assume they have to do with the lsline command I used, but I don't know how to get rid of them. Any help would be appreciated.
  1 件のコメント
Walter Roberson
Walter Roberson 2022 年 9 月 24 日
Note that you only need one lsline call, because lsline finds all scatter plots in the current axes and draws lines for each of them. So draw all the scatter and lsline once.

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

採用された回答

Walter Roberson
Walter Roberson 2022 年 9 月 24 日
Record the handle of all scatter() calls in an array. Pass that array to legend()

その他の回答 (0 件)

カテゴリ

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

製品

Community Treasure Hunt

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

Start Hunting!

Translated by