I have attached pictures of my problem, as you can see i am plotting 4 lines (which are cells) of colour, yellow, red, green and black. The plotting isnt the issue, but the legend gives all the same colour (yellow)
which makes it hard to distinguish. Can someone help me?

댓글 수: 3

Saurabh Sakpal
Saurabh Sakpal 2015년 8월 30일
Walter Roberson
Walter Roberson 2015년 8월 30일
Are you using R2014b or later, or are you using R2014a or earlier? The behavior of "hold on" changed in R2014b so we need to know which of the two situations we are dealing with.
Saurabh Sakpal
Saurabh Sakpal 2015년 8월 30일
I am using 2014b walter robertson

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

 채택된 답변

Geoff Hayes
Geoff Hayes 2015년 8월 30일

2 개 추천

Saurabh - what can you tell us about the dimensions of t_cell{i} and Act_6{i}? Are both arrays, or are one or both matrices?
Or, even better, if you do the following
h = plot(t_cell{i}, Act_6{i}, 'y');
what is h? Typically, the behaviour you describe above is due to the fact that more than one graphics object has been plotted with your single call to plot (which usually happens when one or both of your inputs to plot is a matrix). In your case, at least four may have been plotted. As h will contain all of the handles to the graphics objects called by plot, then if the dimension of this array is greater than one then that will explain the problem.

댓글 수: 9

Saurabh Sakpal
Saurabh Sakpal 2015년 8월 30일
Ok i put h = plot(...) in front of all 4 plot lines and since they are the output of a Diff Equation solver (earlier in the code) each 'plot' line is off different length.
Geoff Hayes
Geoff Hayes 2015년 8월 30일
Just do this for the first plot that colours the graphics object in yellow. What is assigned to h?
Saurabh Sakpal
Saurabh Sakpal 2015년 8월 30일
t_cell{i) and Act_6{i} are outputs of a differential equation, they are vectors (arrays) not matrix.
Saurabh Sakpal
Saurabh Sakpal 2015년 8월 30일
This was the output i got for h for the first plot line i asked. Thanks
Saurabh Sakpal
Saurabh Sakpal 2015년 8월 30일
Some further info on t_cell{1} and Ac_6{1}
Geoff Hayes
Geoff Hayes 2015년 8월 30일
Saurabh - so that is the problem. Your Act_6{1} is a matrix and you are in fact drawing 23 lines instead of one. (The same may be true for your other three lines too.) Is each column of Act_6{1} identical? If so, then just use the first column when plotting this line (since all 23 lines would then be identical).
Saurabh Sakpal
Saurabh Sakpal 2015년 8월 30일
No not all columsn are indentical, all columns are 0, except 11. COlumns 11 all values are roughly 0.99. This is just for Act_6{1} for Act_6(2) (3) and (4) they also have only one non zero column the rest all zero, but they are different dimension amtrices and the non zero column are different numbers.
Saurabh Sakpal
Saurabh Sakpal 2015년 8월 30일
For eg. ok Ac_6{1) ia 23*23 by only column 11 has non zero values,
for Act_6{2} only column 34 of 46 (46*46 matrix) is non zero and some other values for Act_6{3,4}. How do i extract the non zero component for each case?
Saurabh Sakpal
Saurabh Sakpal 2015년 8월 30일
Thanks a lot geoff frr pointing me in the right direction, i managed to isolated the matrices and i got the right answer :)

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

추가 답변 (0개)

카테고리

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

태그

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

질문:

2015년 8월 30일

댓글:

2015년 8월 30일

Community Treasure Hunt

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

Start Hunting!

Translated by