getting user input in title and legend

4 次查看(过去 30 天)
the code is you want to create a graph showing the relationship of an ideal gas between pressure (P) and temperature (T).
the first 2 are Nitrogen, and oxygen the third will be ser input of gas. I created 2 figures. Figure (1) for all plots on the same axis, and the figure 2 is for sublpot of each gas.And ask the user to input the gas name. But how can I input the gas name from the user to the legend or title.
I hope that was clear.

回答(2 个)

Star Strider
Star Strider 2019-4-22
I would use the inputdlg (link) function. You can also use input.
  3 个评论
Star Strider
Star Strider 2019-4-22
mat geek’s Answer moved here:
How can You do that and place it in title or legend?
Star Strider
Star Strider 2019-4-22
Use that to get the user input.
Then use the sprintf function to print it in the title or legend.

请先登录,再进行评论。


Adam Danz
Adam Danz 2019-4-22
In addition to Star Strider's method, the user can directly edit titles and legend strings by selecting them on the figure itself (the user won't be prompted and will have to know how to edit these objects).
Just click on the white arrow, then double-click the title and/or legend to change the string.
190422 174146-Figure 1.jpg

类别

Help CenterFile Exchange 中查找有关 Legend 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by