This question already has an answer here:
Closed 10 years ago.
i have a plot with many cycles of curves all similar but yet different from each other. the objective is for me to find the mean curve from all this curves. i cannot say where is the beginning or final point from each curve, since each cycle is different.
all i have is an excel file with two columns, one with the x coordinates and the other with the y coordinates.
Any help with be appreciated! thank you very very much!
Try to draw plots of different colors. It will be better for perception.
As you still have this in excel you could just build ONE y coordinate vector (median value) and plot this one.
Related
I have a set of data that I plot but the points on the graphs are so closed to each other that you can't see them well nd neither their values because even when I zoom in I can't get to them all. Now what I want to do is to space them out without changing their actual values on the graph. Is the a function or any other ways to do that? I've tried changing the axis and the scale but it didn't help. Mostly those points are in the Y direction. Please help What I really mean is though these points are closed to each other I'd like to create and interval between them so they don't pile up on each other
You can make the vector you are trying to plot to be more sparse taking points after some defined intervals:
plot(x(1:10:end),y(1:10:end))
In this example, I plotted each tenth point. Does it help?
This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
matlab: scatter plots with high number of datapoints
I have 3 vectors of 315,000 elements each. X,Y, and Z. X & Y are coordinates and Z is a value. I must plot the coordinates as points in a 2D graph, the Z is a color indicator at each coordinate of X and Y. I've tried the "scatter" command, but it extremely slow. Would anybody suggest a better way?
thanks!
Depending on what kind of color map you are looking for, you can try something like
zmin=min(Z);
zmax=max(Z);
map=colormap;
color_steps=size(map,1);
hold on
for i=1:color_steps
ind=find(Z<zmin+i*(zmax-zmin)/color_steps & Z>=zmin+(i-1)*(zmax-zmin)/color_steps);
plot(X(ind),Y(ind),'o','Color',map(i,:));
end
The finding is a little expensive but it seems to be quicker than scatter. I'm sure you could optimize this further.
Try cline from MATLAB file exchange here. It looks like it does exactly what you want.
Your code is slow because of the large size of the vectors, not because of the SCATTER function. Try breaking them down into vectors of smaller size (say, 10 elements each) and putting each vector into a cell of a cell array. Then loop through the cell array and scatter each smaller vector individually to avoid loading too much into the memory.
hold on
for i=1:numel(XcoordCellArray):
scatter(XcoordCellArray{i},YcoordCellArray{i},S,ZcoordCellArray{i})
end
This question already has answers here:
Plotting 3-D Matrix *values* in MATLAB
(2 answers)
Closed 7 years ago.
Ive created a 3d matrix in MATLAB. The values of the matrix are the velocity at that point in a rectangular section. I would like a plot with colours showing the values at each position, is this possible?
Phrasing this another way, I have a matrix of size 100x100x200. Id like a graph that has 100x100x200 points and the colour of each of those points is related to its value.
This question is very similar to this question. You might want to check it out.
UPDATE:
Suppose you have a 3D matrix A:
A = rand(100,100,200);
You want to plot each entry of A mapped to a color at its 3D coordinates. First generate the coordinates:
[x,y,z] = meshgrid(1:100,1:100,1:200);
Now you are ready to use scatter3:
scatter3(x(:),y(:),z(:),5,A(:))
Here the : indexing vectorizes the coordinates column-wise.
Hope this helps.
This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
Plotting 4 curves in a single plot, with 3 y-axes
Dear stackoverflowers,
I need to plot 3 curves with same X axis (time) but three different dimensions (Volt, temp, current). The best outlook, to me, would be to have two Y axis on the left side, separated by a few pixel so we can read legend and ticks for each.
The answer to my questions are not plotyy neither multiple X or Y axis . In the first case, it helps me plot two different dimensions, not three.
the latter helps me associate right or left Y axis to a particular curve. I used the YAxisLocation option for my third curve but if I put it right or left, of course it interfers with the other YAxis that was there before. There is no option like left - 20 pixels ?
Thank you for your help.
You could just use plot (which will take care of the scale) and then include a legend to say what your units are (e.g. volts, degrees, etc)
This question already has answers here:
Closed 12 years ago.
Possible Duplicate:
How do I edit the axes of an image in MATLAB to reverse the direction?
Hey guys,
In MatLab I have a pair of axes where the y-axis starts from (0,0) and counts up to (0,100) with tick marks on this x-axis going 0,1,2,...,100. Can a flip it so it goes 100,99,...,0 so the origin would be (0,100)? Any ideas? I know it's possible because I've seen graph figures like this.
set(gca,'YDir','reverse'); before you draw the graph. Thanks to gary comtois's link - stackoverflow.com/questions/2865600/