I want to add some information in the top x axis

3 次查看(过去 30 天)
I have a code that plots the temperature from 4 different sensors, and the x axis shows the logging number, the y axis shows the temperature.
This is my code:
plot(dat00001m.Var3,'DisplayName','dat00001m.Var3');
hold on;
plot(dat00001m.Var4,'DisplayName','dat00001m.Var4');
plot(dat00001m.Var5,'DisplayName','dat00001m.Var5');
plot(dat00001m.Var6,'DisplayName','dat00001m.Var6');
ylabel('Temperatur [℃]');
xlabel('Log#');
legend({'chan101', 'chan102', 'chan103', 'chan104'}, 'Location', 'northeast');
hold off;
output:
But, I want to add another x label on top of the plot that shows the real dime the sensor logged the information. This is saved in my table as 'dat0001m.Var2'.
I want this to log on the same pharameters that are set for the log, so value 0, 500, 1000, 1500, 2000, 2500.
How can i do this? Thank you!

回答(1 个)

Sanjana
Sanjana 2023-3-30
Hi,
I understand that you are looking for ways to label the x-axis using the data in "dat0001m.Var2".
To accomplish this, you can utilize the "xticklabels" function. This function allows you to pass a string array containing the data from "dat0001m.Var2" file as labels for the x-axis.
Please refer to the below link for further help,
Hope this helps!

类别

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

Community Treasure Hunt

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

Start Hunting!

Translated by