简体   繁体   中英

change the scale of plot axis in matlab?

I am plotting a time graph, where the values are my data and indexes are my time index. Now my x-axis is shown as index right now, looks like 0, 1, 2, 3, 4 but I wish to map it my to my time vector with something like

time(index) %output would look like 2012, 1995 etc

so how can I "normalize" my x-axis?

thanks

If your data is contained in the vector data and index are the indices you want to visualize:

plot(time(index), data(index))

will do. This is also explained in the MATLAB help for plot .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM