I have a matrix with 360 columns. I want a 3D plot in which at every 1 degree one column is be ploted with diferent color. Can anyone suggest how to proceed? Let me know if you need further explaination about my problem?
Mostra commenti meno recenti
Let me know if you need further explaination about my problem?
5 Commenti
Walter Roberson
il 29 Mag 2015
You want the columns placed around the outside of a circle, right? For any given column, what should the values in the column represent? Should they represent z coordinates? If so then each one would represent a straight line (that might double back on itself) and the only distinguishing attribute of the points would be the markers.
John D'Errico
il 29 Mag 2015
Modificato: John D'Errico
il 29 Mag 2015
You do realize that 360 different colors will be difficult to distinguish? Or, you could alternate the standard colors, but then they won't be different.
Image Analyst
il 30 Mag 2015
If you can upload a sample picture of what you'd like to obtain, it would really help us visualize what you want.
dpb
il 30 Mag 2015
Put the question in the question box, not the title...
Sanjeev Kumar Singh
il 1 Giu 2015
Risposte (1)
Walter Roberson
il 1 Giu 2015
I have doubts that what you ask is going to turn out looking at all useful, but here is code for what you asked.
R = 500; %adjust to look right
[nrow, ncol, panes] = size(YourMatrix);
assert(panes==1, 'Code not designed for 3D matrices');
%set an N x 3 RGB array "colortab" to be your 360 different colors. This
%needs to be done in RGB because MS Windows supports a maximum of 256
%entries in normal colormapping.
colortab = colormap(hsv(ncol));
%complete the circle and then drop the last point so last column is
%not on top of the first
angles = linspace(0,360,ncol+1) * pi/180; %row vector
[x,y] = pol2cart(angles(1:ncol), R);
X = repmat(x, nrow, 1);
Y = repmat(y, nrow, 1);
lines = plot(X, Y, YourMatrix); %draw in columns
for K = 1 : length(lines)
set(lines(K), 'Color', colortab(K,:)); %set the colors
end
drawnow();
4 Commenti
Walter Roberson
il 1 Giu 2015
I suspect that what you want is more like these lanterns, where differences in your coordinates reflect differences in radius.

Sanjeev Kumar Singh
il 1 Giu 2015
Modificato: Sanjeev Kumar Singh
il 1 Giu 2015
Walter Roberson
il 1 Giu 2015
As a line plot:
R = 500; %adjust to look right
[nrow, ncol, panes] = size(YourMatrix);
assert(panes==1, 'Code not designed for 3D matrices');
colortab = colormap(hsv(ncol));
angles = linspace(0,360,ncol+1) * pi/180; %row vector
[X,Y] = pol2cart( repmat(angles(1:ncol),nrow,1), YourMatrix);
Z = repmat((1:nrow).', 1, ncol);
lines = plot3(X, Y, Z, '*-');
for K = 1 : length(lines)
set(lines(K), 'Color', colortab(K,:)); %set the colors
end
You might at this point also have a look at
ct = repmat(reshape(colortab,1,ncol,3), nrow, 1, 1);
mesh(X,Y,Z,ct);
Image Analyst
il 1 Giu 2015
Sanjeev, is there some reason why you won't upload a picture of what you want? Why make us guess? Walter is more generous than me - I'm not going to guess at code you might want until I see what you want.
Categorie
Scopri di più su Creating, Deleting, and Querying Graphics Objects in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!