Is it possible to connect points on a scatter plot with arrows instead of a line?

Hello,
I am looking to show how oxygen and carbon covary over time in a simple x-y scatterplot. However, instead of the points being connected by lines, I'd like them to be connected by arrows. Is it possible to do this on MatLab or would I need to export the figure and insert the arrows using Adobe?
Here is an example of a plot code:
% Inflata
figure('Color','w');
plot(c13xi87,o18xi87);
ylabel('G. Inflata \delta^1^8O');
set(gca,'YDir','reverse');
xlabel('G. Inflata \delta^1^3C');

5 commentaires

I am confused. You are not using a scatter plot: scatter plots have no ordering between the points.
Not entirely true. I am looking at the covarying of oxygen and carbon isotopes through time. Think of three columns: column one is Age (in thousands of years before present). For each age, there is an oxygen and carbon isotope (columns two and three, respectively). I am plotting column 2 v. column 1, but the position of the points in the scatter plot is also a function of age. Therefore, connecting the points in order will show how they shift with time.
I think you are confused about nomenclature. In Matlab terms, a scatter plot has no ordering. Please read the documentation.
We refer to X-Y plots as scatter plots, which this is. I am connecting the points in a way that shows a third dimension.
"A scatterplot consists of an X axis (the horizontal axis), a Y axis (the vertical axis), and a series of dots. Each dot on the scatterplot represents one observation from a data set. The position of the dot on the scatterplot represents its X and Y values."
Notice the reference to "dots". If you are connecting anything, you do not have a scatter plot. You might have a time series plot, or a series of time series plots.

Connectez-vous pour commenter.

Réponses (3)

aborghes
aborghes le 7 Août 2017
Modifié(e) : Walter Roberson le 8 Juin 2020
Hi Vince, I would recommend using the quiver() function. The doc for it is located here: https://mathworks.com/help/releases/R2017a/matlab/ref/quiver.html
You can do something like the following code, assuming both data-sets are 1-D matrices
for i=1:length(c13xi87) - 1
p1 = [c13xi87(i) o18xi87(i)];
p2 = [c13xi87(i+1) o18xi87(i+1)];
dp = p2 - p1;
quiver(p1(1),p1(2),dp(1),dp(2),0);
hold on
end
hold off
José-Luis
José-Luis le 8 Août 2017
Modifié(e) : José-Luis le 8 Août 2017
x = rand(10,1);
y = rand(10,1);
dx = diff(x);
dy = diff(y)
plot(x,y,'ro');
hold on
quiver(x(1:end-1),y(1:end-1),dx,dy,0)

1 commentaire

Hi Jose. I used your code. Very helpfull. Thank you so much for sharing.
  • Farshid

Connectez-vous pour commenter.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by