Muddy y axis and plotting using coordinates

조회 수: 1 (최근 30일)
Charlie Chen
Charlie Chen 2021년 3월 31일
댓글: Star Strider 2021년 4월 1일
Hi everyone,
I am a newbee of Matlab. I am having some issues with plotting. I could use some help.
When I try to plot multiple sets of data, the axies get mudy. I assue it's caused by the overlapping of different scales. Is there a way to clean it up?
T1=[50 53 55 58 59 60 61 61 62]
T2=[ 48 50 52 54 55 57 58 59 60 61 62 62 63]
dCoF1=[2.088360144 2.348487525 2.48784046 2.67016458 2.795948305 2.84171836 2.619815575 2.663693217 2.6249562]
dCoF2=[3.370696371 2.075218238 2.272783201 2.440811388 2.444426417 2.614530643 2.585023679 2.531044092 2.666287724 2.59727857 2.603275966 3.366966847 2.685168655]
p=plot (T1,dCoF1,"-k",T2,dCoF2,"-c")
p(1).Marker="*"
p(2).Marker="o"
Another issue is that I have a set of data that describe force reading under different temperatures. Naturally I want to visualize the data points. Making the data coordinates fall into "temperature bins". Currently I am using line plot, but I am sure there is a better way to do it.
My Data set:
[(Temperature, Reading)] = [(55,1.98);(58,1.88);(61,2.00);(55,1.93);(56,1.74);(56,1.88)]
I am thinking asking Matlab to plot based on coordinates, but I don't know how to use a matrix to store the coordinates, and use the plot function.Can you give me any insight?
  댓글 수: 2
Star Strider
Star Strider 2021년 3월 31일
I get a much ‘cleaner’ result that what you posted.
What MATLAB release are you using?
Have you updated it with the latest Update?
Charlie Chen
Charlie Chen 2021년 3월 31일
Hi Star Strider,
I am using '9.9.0.1592791 (R2020b) Update 5'.
This issue happened after I plot some data using "hold on".
Actually today I ran this section and the issue is gone. Maybe I should share this piece:
ax = axes;
ax.ColorOrder = [1 1 0;1 0 1; 0 1 1; 1 0 0; 0 1 0; 0 0 1; 1 1 1; 0 0 0]
hold on
for i = 1:22
plot([1:48285],result(:,i))
end
hold off
Please let me know.

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

채택된 답변

Star Strider
Star Strider 2021년 3월 31일
I am thinking asking Matlab to plot based on coordinates, but I don't know how to use a matrix to store the coordinates, and use the plot function.Can you give me any insight?
If they all have the same length (with respect to the independent variable, as they appear to do in this Comment), try something like this:
x = 1:20;
y = rand(5,20)+(0:4).';
figure
plot(x, y)
ax = gca;
ax.ColorOrder = [1 1 0;1 0 1; 0 1 1; 1 0 0; 0 1 0; 0 0 1; 1 1 1; 0 0 0];
.
  댓글 수: 4
Charlie Chen
Charlie Chen 2021년 4월 1일
Thanks a lot, my friend!
Star Strider
Star Strider 2021년 4월 1일
As always, my pleasure!

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by