Mostra commenti meno recenti
is there any way to get the (x,y) coordinates of a scatterplot.
Risposta accettata
Più risposte (2)
Tasos Giannoulis
il 25 Gen 2017
SCATTERPLOT returns a handle to the figure. The child of the figure is the "Axes", whose child is a "Line" (even though the Line object has markers only, with no lines connecting them). The Line object has the X and Y values:
h = scatterplot(awgn(2*randi([0 1], 10, 1)-1, 20));
x = h.Children.Children.XData;
y = h.Children.Children.YData;
While this answers the question, I wonder why you want to get the XData/YData from the plot, given that these were the input of the SCATTERPLOT function at the first hand. You can separate the complex number to its real and imaginary parts using the REAL and IMAG functions.
If you were looking for the coordinates of the figure window instead, you can use:
h.Position
Walter Roberson
il 18 Mar 2011
0 voti
get() the XData and YData properties from the plot handle.
3 Commenti
jessica david
il 18 Mar 2011
Matt Fig
il 18 Mar 2011
Xdata is a property of the plotted object, not a figure object. I don't know about the SCATTERPLOT function, but this works for PLOT:
L = plot(1:10);
get(L,'xdata')
Matt Fig
il 18 Mar 2011
According to the doc, SCATTERPLOT returns the handle to the figure, which seems very strange to me. However, you might still be able to find the data with FINDALL.
H = findall(0,'type','line')
and if this doesn't find it, you will have to call FINDALL with only the 0 and look at each element of H to find which one has the data.
Categorie
Scopri di più su Graphics Performance in Centro assistenza e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!