Hi ,
I have data as follow for about 58 rows.
Name Area lotNum Type Month1 Month2 Month3.... MonthN
Rest1 biz 123 south 5 5 7 .... 3
Rest1 nonBiz 123 south 2 11 8 ..... 1
Rest1 biz 456 south 11 9 3 ..... 24
rest2 biz 123 south 9 3 23 ..... 21
rest3 biz 789 south 23 3 4 ...... 1
I want to draw graph for each row for months on x-axis and value on y-axis. Also is it possible to have this graph saved in a file. ?
Thanks.

댓글 수: 6

jgg
jgg 2015년 12월 10일
If I understand your question correctly, this should produce either 58 seperate graphs, or a single graph with 58 lines on it. Are you sure this is what you want to do? That's probably going to be unreadable.
jgg
jgg 2015년 12월 10일
편집: jgg 2015년 12월 10일
If it is, you can just concatenate your N months variables together by columns, into a 58xN matrix (call it M) where the rows correspond to the 58 observations. Then, you can just do plot(M,[1:N]). You can then save the figure or edit it, etc.
Neesha
Neesha 2015년 12월 10일
So i agree having 58 lines on one graph will make it unreadable. I am ok to group them by 'Name'.
Now having said that, I do not understand what you are suggesting. I know plot() function, just do not how to get M and N as you are suggesting. My months' data can be easily in matrix/dataset format. I will try what you suggested and see if it works.
How do i save it to file?
Neesha
Neesha 2015년 12월 10일
Ok so I was able to group them by 'Name' and get my plot as you suggested. How do i label the line that for what 'lot' it is for. And how do i save the plot figure in a file from code?
Neesha
Neesha 2015년 12월 10일
So i figured Xclicks and xTicks. Just cannot get them to align. Since my N is 192, how do i get months only which aligns to Xticks i decide
Neesha
Neesha 2015년 12월 10일
편집: Neesha 2015년 12월 10일
After my graph is created i do following
arrayX = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190]; % I have 192 months
for i = 1:xSize
if mod(i, 10) == 0
mLabel(j) = monLabel(i);
j = j + 1;
end
end
set(gca,'XTick',arrayX]);
set(gca,'XTickLabel', mLabel)
this gets me label positioned at every 10 months so the labels donot crowd on each other and can read easily. I would love it to be done little less hardcorded then it is right now

댓글을 달려면 로그인하십시오.

답변 (1개)

Image Analyst
Image Analyst 2015년 12월 10일

0 개 추천

댓글 수: 1

Neesha
Neesha 2016년 1월 14일
how is it different from saveas()

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Creating, Deleting, and Querying Graphics Objects에 대해 자세히 알아보기

태그

아직 태그를 입력하지 않았습니다.

질문:

2015년 12월 10일

댓글:

2016년 1월 14일

Community Treasure Hunt

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

Start Hunting!

Translated by