Home Relative Markersize in Matlab plots

# Relative Markersize in Matlab plots

janoliver
1#
janoliver Published in 2011-06-08 16:51:26Z
 I am trying to plot a matrix where each element is in one out of two states. (ising model..) Now, I would like to have one state colored and the other one white. That works using [i,j] = find(S); figure(gcf); plothandle = scatter(i,j); axis([0 nNodes+1 0 nNodes+1]);  when S holds the Spins and one state is equal to 0. (find returns a matrix of only non-zero elements) To have a useful plot, the sizes of the markers should be 1x1 in RELATIVE coordinates. So if the whole matrix S would be in a state non-zero, everything would be colored. However, it seems like Matlab only allows MarkerSizes in points or inches. How could I solve this? One idea I had was, that I find out the point-size of the axes and then can easily calculate how big my markers should be. Then I would have to create a callback function if I want to zoom in and so on. Also, I have not yet found a way (without the image acq. toolbox) to find out the absolute size of my axes. To clarify what I want: How could I plot a chessboard using a matrix with 1 for black and 0 for white fields?
gnovice
2#
 For displaying data of this sort I generally prefer IMAGE or IMAGESC to PCOLOR since PCOLOR won't display the last row and column of the matrix when using faceted shading (the default). Also, IMAGE and IMAGESC flip the y axis so the image more intuitively matches what you think of when looking at a matrix (i.e. rows start from 1 at the top). You can visualize your matrix like this: S = round(rand(20)); %# Sample 20-by-20 matrix of ones and zeroes imagesc(S); %# Plot the image colormap([1 1 1; 0 0 0]); %# Set the colormap to show white (zero elements) and %# black (non-zero elements)  And here's a sample image:
 Just as a suggestion, you can try using pcolor instead of scatter' Example: pcolor(hadamard(20)) colormap(gray(2)) axis ij axis square `