Filter löschen
Filter löschen

A little bit tricky 2d plots

1 Ansicht (letzte 30 Tage)
Joon Jeon
Joon Jeon am 11 Apr. 2012
I have three (100*2) matrix. (saying A, B and C)
Each column must be graphed against 1:100.
1. Firstly, if I want to show those 6 columns in one plot, how to do it? My try was
plot(A,B,C)
plot(1:100, A, 1:100, B, 1:100, C)
Both don't work.
2. Secondly, I have two indices for horizontal axis. It is e.g.
X1=1:1:100;X2=100:-1:1
For Vector A and B, X1 should be the versus. And for Vector C, X2 should be the versus.
Since I want all the vectors in the same plot, I want to use both X1 and X2 at the same time. Like.. making two index layers in the horizontal. Is it possible?
3. When I just plot X2 versus any vector, since X2 is decreasing, the order of data in vector changes in the plot. In the horizonal, X2 starts from 1 and vector gives the last value (100,:) first. How can I reverse it back?
4. Also, I want to give some name on xtick. Since X1 and X2 mean some kind of intensity degree in my data. I want to name it such as Strong, Even, Weak from 1 to 100. How should be it set?
Thanks.

Antworten (1)

Honglei Chen
Honglei Chen am 11 Apr. 2012
1.
plot([A B C]);
2.
plotyy(X1,[A B],X2,C);
but because MATLAB always do the x axis from smallest to largest, your X1 and X2 are essentially the same.
3. 4.
To reverse the plot, I think you need to do some trick. Like plotting the data backwards and then label your axes differently. This also related to modifying the ticks. The following page should be helpful for those tasks.

Kategorien

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

Community Treasure Hunt

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

Start Hunting!

Translated by