How to get the title to change on a graph when on the menu function a different item is chosen

2 次查看(过去 30 天)
location_menu= menu('please select a location data to plot',LocationID);
graph1=Ice(:,location_menu)
plot(Days,graph1,'ro');
grid on
I want it to change the title for when a different locationID is chosen the title location will change
for example i choose new york a data graph of new york loads and the title says 'location newyork over time'.
then when i click texas a graph data of texas whill show up witht the title 'location texas over time'.
  6 个评论
Adam Danz
Adam Danz 2020-2-7
When you're using a menu to select something that will change an object on the plot, the methods are the same wether you're changing a title, color, the data being plotted, etc. menu() outputs an index of your selection. That index is used to select an option stored in an array. That array could contain a list of titles, a list of data to plot, a list of colors, etc.
Part of the reason you get incomplete answers in this and the other quesiton is because you aren't providing much information in you question which is fine. The other reason is so you can learn an approach that you can apply to your needs. It's not rewarding to do other people's projects for them; but it is rewarding to help someone else learn; at least for me.

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 2-D and 3-D Plots 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by