how to plot series of y-axis that only on single point of x-axis?
2 views (last 30 days)
Show older comments
Engineer Batoor khan mummand
on 16 Oct 2020
Commented: Durganshu
on 16 Oct 2020
Hi al:
i want to plot series of data but at y-axis i have more than one ponit and at x-axis i have one ponit for exampe.
at x-axis i have
ax.XTick = [ 1 2 3 4 5 6 7 8 ];
ax.XTickLabels = {'07:00AM','08:00AM','9:00AM','10:00AM','11:00AM','12:00PM','1:00PM}','2:00PM'};
ax.XTickLabelRotation = 45;
now i want plot these points y1=[12 13 15 16] on x-axis fix point which is 07:00AM
y2=[123 44 555 324 643 332] on x-axis fix point which is 08:00AM
y3=[32 45 53 67 86 98 67] on x-axis fix point which is 09:00AM
y4=[77 88 99 45 32 333 44 555 666] on x-axis fix point which is 01:00PM.
thanks
0 Comments
Accepted Answer
Durganshu
on 16 Oct 2020
Edited: Durganshu
on 16 Oct 2020
ax.XTick will only set the ticks values along the x-axis. What is the actual range of x?
As far as I can assume the values of x:
x=[1:8];
y1=[12 13 15 16];
...
...
...
... and so on
plot(x(1),y1, "--o", x(2), y2,"--o", x(3), y3,"--o", x(4), y4,"--o"); % similarly for x(5), y5 to x(6) to y6
xticks([ 1 2 3 4 5 6 7 8 ])
Xticklabels({'07:00AM','08:00AM','9:00AM','10:00AM','11:00AM','12:00PM','1:00PM','2:00PM'});
The code can be improved if you use loops and combine all the y values in a single matrix (cell arrays).
3 Comments
Durganshu
on 16 Oct 2020
You'll have to process the file and store all the information in form of variables. Then you can proceed in the same way and obtain the plots. With an incresed size and large database, the job may become a bit tedious but it'll be done easily if you keep the track of variables and plot them accordingly.
More Answers (0)
See Also
Categories
Find more on Logical in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!