'Hold on' not working for pcolor graph?
3 views (last 30 days)
Show older comments
Wafa'a Shanti
on 15 May 2018
Answered: Jan René Haak
on 4 Jan 2021
Hello. I have calculated an average mean temperature for a given time and height. The sequence follows through eleven different data sets, and I have used pcolor to graph them. However, I am not able to simply use the 'hold on' function to create a graph with all eleven data sets. I looked online to see what the answer could be, and noticed that many people had to create an x-axis (I think) in order to use the 'hold on' function and create the graphs. After a few attempts on my own, I have been very unsuccessful at doing this. Can anyone give me examples on how I would set my axes and use pcolor to create a graph?
I tried:
ax1=(110600:500:142600);
figure(1)
pcolor(x1,y1,temp1);
hold(ax1,'on')
pcolor(x2,y2,temp2);
pcolor(x3,y3,temp3);
pcolor(x4,y4,temp4);
pcolor(x5,y5,temp5);
pcolor(x6,y6,temp6);
pcolor(x7,y7,temp7);
pcolor(x8,y8,temp8);
pcolor(x9,y9,temp9);
pcolor(x10,y10,temp10);
pcolor(x11,y11,temp11);
hold off
I am trying to set my x-axis to a incremental time that includes all 11 data sets, but MATLAB did not recognize the format 'hold(ax1,'on')'. Thank you in advance.
0 Comments
Accepted Answer
Ameer Hamza
on 15 May 2018
Edited: Ameer Hamza
on 15 May 2018
You are using the hold command wrong. The first input to hold must be an axis object. Use it like this
figure(1)
p = pcolor(x1,y1,temp1);
hold(p.Parent,'on')
the subsequent calls to pcolor() will plotted on the same axis.
16 Comments
Ameer Hamza
on 16 May 2018
If it is related to the question, i.e. pcolor() and hold() then you are welcome to comment here. If it is different then it is better to start a new question.
More Answers (1)
Jan René Haak
on 4 Jan 2021
I have almost the same problem. However, I have a matrix S that I want to plot using pcolor. So far, no problem. But the matrix S is calculated in a loop and changes every iteration. Is there a possibility, just like hold on for normal plotting, to plot S every iteration?
0 Comments
See Also
Categories
Find more on Graphics Object Properties in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!