# plotting the points near to origin

4 Ansichten (letzte 30 Tage)
sampath kumar punna am 29 Okt. 2019
X Y
18 10
72 28
43 28
43 61
24 43
10 55
22 24
51 75
52 75
21 41
39 35
9 31
30 60
25 10
19 37
55 75
22 33
18 61
31 39
33 15
22 24
42 43
13 16
70 46
70 74
here is my x and y values, if i plot my graph i get it as shown below but i dont my graph with all points of my data
i wanted my graph like this as shown below, only the highlited part which is near to the zero, i want some points like 10-15 values which are near to the point zero from my data, and can i get values the points.
please can you help me to do this, which will be very help full for my execution
thanks
##### 0 Kommentare-2 ältere Kommentare anzeigen-2 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

### Akzeptierte Antwort

Rik am 29 Okt. 2019
Your data doesn't seem to fit your plots. The code below should give you an idea of how you could do this. You could also define a cutoff distance and show everything below that distance.
X=XY(:,1);Y=XY(:,2);%XY is the array as you posted in your question
dist_to_origin=sqrt(X.^2+Y.^2);
[~,order]=sort(dist_to_origin);
plot(X(order(1:10)),Y(order(1:10)),'o')
axis([0 80 0 80])
%instead of order(1:10) you can also use this:
L=dist_to_origin<=45;
plot(X(L),Y(L),'o')
##### 1 Kommentar-1 ältere Kommentare anzeigen-1 ältere Kommentare ausblenden
sampath kumar punna am 29 Okt. 2019
thanks for the help rik

Melden Sie sich an, um zu kommentieren.

### Kategorien

Mehr zu Graph and Network Algorithms finden Sie in Help Center und File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by