I want to add some information in the top x axis
1 view (last 30 days)
Show older comments
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!
0 Comments
Answers (1)
Sanjana
on 30 Mar 2023
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!
0 Comments
See Also
Categories
Find more on Axis Labels 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!