getting user input in title and legend
1 view (last 30 days)
Show older comments
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.
0 Comments
Answers (2)
Star Strider
on 22 Apr 2019
3 Comments
Star Strider
on 22 Apr 2019
mat geek’s Answer moved here:
How can You do that and place it in title or legend?
Star Strider
on 22 Apr 2019
Use that to get the user input.
Then use the sprintf function to print it in the title or legend.
Adam Danz
on 22 Apr 2019
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](https://www.mathworks.com/matlabcentral/answers/uploaded_files/215453/190422%20174146-Figure%201.jpeg)
0 Comments
See Also
Categories
Find more on Legend in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!