Muddy y axis and plotting using coordinates

1 Ansicht (letzte 30 Tage)
Charlie Chen
Charlie Chen am 31 Mär. 2021
Kommentiert: Star Strider am 1 Apr. 2021
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 Kommentare
Star Strider
Star Strider am 31 Mär. 2021
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 am 31 Mär. 2021
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.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Star Strider
Star Strider am 31 Mär. 2021
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 Kommentare
Charlie Chen
Charlie Chen am 1 Apr. 2021
Thanks a lot, my friend!
Star Strider
Star Strider am 1 Apr. 2021
As always, my pleasure!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu 2-D and 3-D Plots finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by