Plot two x-axis in a graph with Time(calendar month/year) on axis and Hour on another x-axis
Show older comments
hello guys, I am facing an issue in plotting, would really appreciate if some can help/suggest any method.
I have data in 3 columns,
Column #1= Date(YYYY-MM-DD)
Column #2= Time(hr)
Column #3= Temp
I want to plot a graph with Temperature on y-axis and need to have two x-axis. One x-axis should have Time(hr) and other x-axis should have Date(YYYY-MM-DD).
At the end I want time(Hr) should match with date on the plot. Means when date is 2021-05-18 on one x-axis, time on the another x-axis should be 1000.44, as per data
I am using Matlab R2021b.
Thanks
Accepted Answer
More Answers (1)
Peter Perkins
on 14 Mar 2022
0 votes
This made little sense to me until I realized that the times were elapsed times from the beginning of data collection i hours, and not time of day. You can plot temp against a datetime variable, or against a duration variable (you may want to convert those numeric elapsed times to durations using the hours function), but not against both on the same axis. I suspect that you may end up making a plot against one or the other, and then adding the one you did not use as text.
1 Comment
Harsimran Singh
on 14 Mar 2022
Categories
Find more on Axes Appearance 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!
