MATLAB: What is the function to plot this graph matrix arrayplot Hi I have an array with values between 0 and 1 and wanted to draw a graph like this: http://imm.io/apWy Thanks, Fernando Best Answer scalefactor = 100; %I am guessing![X,Y] = ndgrid(1:size(YourArray,1), 1:size(YourArray,2));scatter(X(:), Y(:), scalefactor*YourArray(:), YourArray(:))You will probably want to play with the scale factor, and probably want to play with the colormap . Related SolutionsMATLAB: Apply colormap to plot(x,y) To create the colormap, you could use spectrumRGB in Spectral and XYZ Color Functions.EDIT: Here is a little demo.n = 20; x = rand(n,1); y = rand(n,1); spect = linspace(300,830,n);sRGB = spectrumRGB(spect);sRGB = squeeze(sRGB); % For some reason spectrumRGB returns a 3D arrayfigure; hold onfor i = 1:n line(x(i),y(i),'Marker','*','Linestyle','none','Color',sRGB(i,:))endspectrumlabel(gca) MATLAB: How to join two set of points using scatter command x1=1:10; y1=1:10;new_x1 = x1;new_y1 = y1*2;cmap = colormap(jet(length(x1)));figure(1);scatter(x1,y1,[],cmap,'Marker','d');hold on;scatter(new_x1,new_y1,[],cmap,'Marker','*');hold off;for i = 1:length(x1)line([x1(i),y1(i)],[new_x1(i),new_y1(i)],'Color',cmap(i,:));end Related QuestionCreate plot with multiple overlayed lines, where colorbar corresponds to color of lineHow do i create a colour quiver plot (colquiver) on top of a pcolor depth mapHow to rotate graphHow to make ‘.’ Markers transparent in a Scatter plot
Best Answer