How do I list values of variables in legend?

4 ビュー (過去 30 日間)
Maureen Laverty
Maureen Laverty 2015 年 12 月 3 日
コメント済み: Arnab Roy 2019 年 10 月 8 日
Hi there,
I've written a script for a function which contains 3 variables (x,y,z).
z can be set as constant value, so the function can be plotted against x.
I'm trying to find a way of labelling my graph to indicate which curve belongs to which y-value (preferably using the legend function).
Any suggestions would be appreciated. Thanks!

採用された回答

Image Analyst
Image Analyst 2015 年 12 月 3 日
This is confusing. Show a graph with what you have so far. I don't know if you have a plot with 1, 2, or 3 curves on it and what the horizontal variable is and what the vertical dependent variable(s) is/are.
A curve will have many values usually. Let's say x and y are 100 elements long. Do you want all hundred values in the legend? You can use sprintf() to create strings which you can then send into legend(). Alternatively you can use text() to place a string with the value in it next to each marker.
  5 件のコメント
Khusro Kamaluddin
Khusro Kamaluddin 2018 年 4 月 10 日
Thanks A lot !!!! :D :D :D
Arnab Roy
Arnab Roy 2019 年 10 月 8 日
Thank you! This works great. It could also work as follows (worked for me at least):
ca{k} = ['Curve #' num2str(k)];

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

その他の回答 (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