Shinobii
Shinobii

Reputation: 2561

Plot values to grid (MATLAB)

I have X and Y data points (locations) I have generated to simulate a spiral trajectory. I also have raw data that I would like to plot at these points.

The data points X and Y, as well as the raw data are 4x500 matrices.

I would like to plot the raw data at the locations specified by X and Y.

I have tried using functions such as plot3, mesh, and surf; however none of them plot the data without having the points connected.

In MRI lingo, I am trying to plot raw spiral k-space (I simply want to plot it).

I feel like like there is a very simple answer here. Any comments would be greatly appreciated.

My failed attempts (which all somewhat fail the same way):

1. surf(X,Y,log(Kspace),'EdgeColor','None','facecolor','interp'), view(2)
2. pcolor(X,Y,log(Kspace))
3. mesh(X,Y,log(Kspace))

Here is an example of what I would like to see. In terms of code, there's not much there (other than the generation of the spiral trajectory, which I cannot share). I am just looking for a proof of concept way to achieve my goal.

Spiral K-space

Upvotes: 1

Views: 280

Answers (1)

Luis Mendo
Luis Mendo

Reputation: 112659

I think you want scatter:

x = (30-(0:.01:20)).*sin((0:.01:20)*pi); % Just some example x data
y = (30-(0:.01:20)).*cos((0:.01:20)*pi); % Just some example x data
z = 1:numel(x); % Just some example z (color) data
scatter(x,y,20,z,'.'); % 20 is marker size. Adjust manually
set(gca,'color','black') % black background
colormap parula % choose colormap
axis equal % set equal scale on both axes

enter image description here

Upvotes: 2

Related Questions