how to plot series of y-axis that only on single point of x-axis?
2 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Durganshu
2020-10-16
编辑:Durganshu
2020-10-16
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 个评论
Durganshu
2020-10-16
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.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!