how to plot series of y-axis that only on single point of x-axis?

조회 수: 4 (최근 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

채택된 답변

Durganshu
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
Engineer Batoor khan mummand
Engineer Batoor khan mummand 2020년 10월 16일
hi Durganshu Mishra:
if we have large file and we want plot it against X-axis how we can easly plot it.
for example i have hourly expenses daily and i want plot it in graph for whole the year so i am asking if i nominat every day and than plot it against x-axis it will be very hard inmatlab.
thanks
Durganshu
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 CenterFile Exchange에서 Graphics Performance에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by