Extract X,Y data from scatter plot (2024)

43visualizaciones (últimos 30días)

Mostrar comentarios más antiguos

Pichawut Manopkawee el 26 de Sept. de 2020

  • Enlazar

    Enlace directo a esta pregunta

    https://la.mathworks.com/matlabcentral/answers/600217-extract-x-y-data-from-scatter-plot

  • Enlazar

    Enlace directo a esta pregunta

    https://la.mathworks.com/matlabcentral/answers/600217-extract-x-y-data-from-scatter-plot

Comentada: Pichawut Manopkawee el 27 de Sept. de 2020

Respuesta aceptada: Cris LaPierre

  • untitled.png

Hi All,

Could you giving a code or advice how to extract X,Y data from a scattered plot?

I have tried several ways following previous suggestions on website, none of that works for me.

I've attached the figure as what I want to extract those values out.

I strongly hope that one of you might help me solve this issue.

Thanks in advance,

Pete

4 comentarios

Mostrar 2 comentarios más antiguosOcultar 2 comentarios más antiguos

KSSV el 26 de Sept. de 2020

Enlace directo a este comentario

https://la.mathworks.com/matlabcentral/answers/600217-extract-x-y-data-from-scatter-plot#comment_1025518

  • Enlazar

    Enlace directo a este comentario

    https://la.mathworks.com/matlabcentral/answers/600217-extract-x-y-data-from-scatter-plot#comment_1025518

You want to extract those values from the atatched .png file?

Pichawut Manopkawee el 26 de Sept. de 2020

Enlace directo a este comentario

https://la.mathworks.com/matlabcentral/answers/600217-extract-x-y-data-from-scatter-plot#comment_1025671

  • Enlazar

    Enlace directo a este comentario

    https://la.mathworks.com/matlabcentral/answers/600217-extract-x-y-data-from-scatter-plot#comment_1025671

Editada: Pichawut Manopkawee el 26 de Sept. de 2020

Hi

Actually, I plot them from two matrix files. However, they have a huge number that I do not know which point represents x,y data. I focus on only the data that less than 100 m2. So, I would like to get y data on those point below 100 m2.

Enlace directo a este comentario

https://la.mathworks.com/matlabcentral/answers/600217-extract-x-y-data-from-scatter-plot#comment_1025710

  • Enlazar

    Enlace directo a este comentario

    https://la.mathworks.com/matlabcentral/answers/600217-extract-x-y-data-from-scatter-plot#comment_1025710

If you haved the data used to create the plot, there are better ways of doing this. You can figure out what X is from the plotting code. What is you plot command?

Pichawut Manopkawee el 26 de Sept. de 2020

Enlace directo a este comentario

https://la.mathworks.com/matlabcentral/answers/600217-extract-x-y-data-from-scatter-plot#comment_1025728

  • Enlazar

    Enlace directo a este comentario

    https://la.mathworks.com/matlabcentral/answers/600217-extract-x-y-data-from-scatter-plot#comment_1025728

This is a plot command

semilogx(saproduct,laplacian,'k.','markersize',8);

saproduct and laplacian are two matrix containing values of 756x519 single

Iniciar sesión para comentar.

Iniciar sesión para responder a esta pregunta.

Respuesta aceptada

Cris LaPierre el 26 de Sept. de 2020

  • Enlazar

    Enlace directo a esta respuesta

    https://la.mathworks.com/matlabcentral/answers/600217-extract-x-y-data-from-scatter-plot#answer_500857

  • Enlazar

    Enlace directo a esta respuesta

    https://la.mathworks.com/matlabcentral/answers/600217-extract-x-y-data-from-scatter-plot#answer_500857

Abrir en MATLAB Online

Assuming you have a *.fig file and not a .png, first open the fig file in MATLAB then run the following code.

s=findobj(gca,'Type','Scatter');

X = s.XData;

Y = s.YData;

6 comentarios

Mostrar 4 comentarios más antiguosOcultar 4 comentarios más antiguos

Pichawut Manopkawee el 26 de Sept. de 2020

Enlace directo a este comentario

https://la.mathworks.com/matlabcentral/answers/600217-extract-x-y-data-from-scatter-plot#comment_1025677

  • Enlazar

    Enlace directo a este comentario

    https://la.mathworks.com/matlabcentral/answers/600217-extract-x-y-data-from-scatter-plot#comment_1025677

Hi,

When I run the first code, s doesn't have any properties or values associated. It says 0x0 GraphicsPlaceholder.

Also, when I run the second and third codes you provided, I get these messages from MATLAB.

'unrecognized method, property, or field 'XData' for class 'matlab.graphics.GraphicsPlaceholder'

'unrecognized method, property, or field 'YData' for class 'matlab.graphics.GraphicsPlaceholder'

Cris LaPierre el 26 de Sept. de 2020

Enlace directo a este comentario

https://la.mathworks.com/matlabcentral/answers/600217-extract-x-y-data-from-scatter-plot#comment_1025719

  • Enlazar

    Enlace directo a este comentario

    https://la.mathworks.com/matlabcentral/answers/600217-extract-x-y-data-from-scatter-plot#comment_1025719

Editada: Cris LaPierre el 26 de Sept. de 2020

Abrir en MATLAB Online

I feel like we're missing some details. Did you have the figure window open when you ran the code? Is your figure created using the scatter function or did you use plot? I assumed scatter. Here's a full working example using plot.

plot([1:5],[10:14],'o');

s=findobj(gca,'Type','Line')

x = s.XData;

y = s.YData;

x =

1 2 3 4 5

y =

10 11 12 13 14

You could do something similar if your plot was created using scatter

scatter([1:5],[10:14]);

s=findobj(gca,'Type','Scatter')

x = s.XData;

y = s.YData;

x =

1 2 3 4 5

y =

10 11 12 13 14

Cris LaPierre el 26 de Sept. de 2020

Enlace directo a este comentario

https://la.mathworks.com/matlabcentral/answers/600217-extract-x-y-data-from-scatter-plot#comment_1025734

  • Enlazar

    Enlace directo a este comentario

    https://la.mathworks.com/matlabcentral/answers/600217-extract-x-y-data-from-scatter-plot#comment_1025734

Editada: Cris LaPierre el 26 de Sept. de 2020

Abrir en MATLAB Online

Of course, if you are creating the plot yourself, this could be simplified using a handle.

L = plot([1:5],[10:14],'o');

X = L.XData;

Y = L.YData;

Of course, if the point is to capture the x and y values, it would make more sense to do this.

X = 1:5;

Y = 10:14;

plot(X,Y,'o')

Pichawut Manopkawee el 26 de Sept. de 2020

Enlace directo a este comentario

https://la.mathworks.com/matlabcentral/answers/600217-extract-x-y-data-from-scatter-plot#comment_1025737

  • Enlazar

    Enlace directo a este comentario

    https://la.mathworks.com/matlabcentral/answers/600217-extract-x-y-data-from-scatter-plot#comment_1025737

Because it is a semilog plot, so I don't use scatter or plot. Here I used

semilogx(saproduct,laplacian,'k.','markersize',8);

saproduct and laplacian are two matrix containing values of 756x519 single.

They contain huge numbers

Cris LaPierre el 26 de Sept. de 2020

Enlace directo a este comentario

https://la.mathworks.com/matlabcentral/answers/600217-extract-x-y-data-from-scatter-plot#comment_1025773

  • Enlazar

    Enlace directo a este comentario

    https://la.mathworks.com/matlabcentral/answers/600217-extract-x-y-data-from-scatter-plot#comment_1025773

Editada: Cris LaPierre el 26 de Sept. de 2020

Abrir en MATLAB Online

Now we're getting somewhere! When passed matrices, MATLAB will plot each column as its own series. That means your semilogx plot is made up of 519 data series with 756 data pairs in each one. Since you are setting your marker color, you probably noticed that (each series is assigned a different color). To extract the data from the figure, you would have to loop through each line object, combining the data as you go.

Luckily, since you have the data and are creating the plot, we don't have to do that. We can use linear indexing instead to create the exact same semilogx plot, but with all the data in a single series. This makes it easier to figure out the [X,Y] pairing. Linear indexing turns both matrices into column vectors by stacking the columns on top of each other (column 2 is directly under column 1, etc).

X = saproduct(:);

Y = laplacian(:);

semilogx(X,Y,'k.','markersize',8)

X and Y are vectors with size 392364 x 1.

Pichawut Manopkawee el 27 de Sept. de 2020

Enlace directo a este comentario

https://la.mathworks.com/matlabcentral/answers/600217-extract-x-y-data-from-scatter-plot#comment_1026223

  • Enlazar

    Enlace directo a este comentario

    https://la.mathworks.com/matlabcentral/answers/600217-extract-x-y-data-from-scatter-plot#comment_1026223

Thank you so much Cris LaPierre

Iniciar sesión para comentar.

Más respuestas (0)

Iniciar sesión para responder a esta pregunta.

Ver también

Categorías

MATLABGraphics2-D and 3-D PlotsData Distribution PlotsScatter Plots

Más información sobre Scatter Plots en Help Center y File Exchange.

Etiquetas

  • scattered data
  • extract value
  • plot

Community Treasure Hunt

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

Start Hunting!

Se ha producido un error

No se puede completar la acción debido a los cambios realizados en la página. Vuelva a cargar la página para ver el estado actualizado.


Translated by Extract X,Y data from scatter plot (13)

Extract X,Y data from scatter plot (14)

Seleccione un país/idioma

Seleccione un país/idioma para obtener contenido traducido, si está disponible, y ver eventos y ofertas de productos y servicios locales. Según su ubicación geográfica, recomendamos que seleccione: .

También puede seleccionar uno de estos países/idiomas:

América

  • América Latina (Español)
  • Canada (English)
  • United States (English)

Europa

  • Belgium (English)
  • Denmark (English)
  • Deutschland (Deutsch)
  • España (Español)
  • Finland (English)
  • France (Français)
  • Ireland (English)
  • Italia (Italiano)
  • Luxembourg (English)
  • Netherlands (English)
  • Norway (English)
  • Österreich (Deutsch)
  • Portugal (English)
  • Sweden (English)
  • Switzerland
    • Deutsch
    • English
    • Français
  • United Kingdom(English)

Asia-Pacífico

  • Australia (English)
  • India (English)
  • New Zealand (English)
  • 中国
  • 日本Japanese (日本語)
  • 한국Korean (한국어)

Comuníquese con su oficina local

Extract X,Y data from scatter plot (2024)
Top Articles
People Finder Jll
LIVE Olympische Spelen 2024 | Hockeyers kunnen eerste finale in twaalf jaar ruiken, gouden zeilrace Marit Bouwmeester uitgesteld - Gelderland nieuws - NewsLocker
Section 4Rs Dodger Stadium
Elleypoint
Myexperience Login Northwell
Jailbase Orlando
Northern Whooping Crane Festival highlights conservation and collaboration in Fort Smith, N.W.T. | CBC News
Www.craigslist Augusta Ga
Songkick Detroit
Zoebaby222
Osrs Blessed Axe
No Hard Feelings Showtimes Near Cinemark At Harlingen
Log in or sign up to view
Fdny Business
Jinx Chapter 24: Release Date, Spoilers & Where To Read - OtakuKart
라이키 유출
How To Cancel Goodnotes Subscription
Aaa Saugus Ma Appointment
Sulfur - Element information, properties and uses
Icivics The Electoral Process Answer Key
Finalize Teams Yahoo Fantasy Football
Craigslist Northfield Vt
Minnick Funeral Home West Point Nebraska
R&S Auto Lockridge Iowa
Dove Cremation Services Topeka Ks
Danielle Moodie-Mills Net Worth
Scott Surratt Salary
Www.1Tamilmv.con
Happy Shuttle Cancun Review
Dairy Queen Lobby Hours
Fairwinds Shred Fest 2023
Red Sox Starting Pitcher Tonight
Ixlggusd
Cars And Trucks Facebook
Skip The Games Ventura
Troy Gamefarm Prices
Gpa Calculator Georgia Tech
Felix Mallard Lpsg
Hellgirl000
Why I’m Joining Flipboard
2023 Fantasy Football Draft Guide: Rankings, cheat sheets and analysis
Download Diablo 2 From Blizzard
Dr Mayy Deadrick Paradise Valley
Tinfoil Unable To Start Software 2022
15 Best Places to Visit in the Northeast During Summer
Das schönste Comeback des Jahres: Warum die Vengaboys nie wieder gehen dürfen
Congruent Triangles Coloring Activity Dinosaur Answer Key
4Chan Zelda Totk
ESPN's New Standalone Streaming Service Will Be Available Through Disney+ In 2025
Att Corporate Store Location
Invitation Quinceanera Espanol
Generator für Fantasie-Ortsnamen: Finden Sie den perfekten Namen
Latest Posts
Article information

Author: Greg Kuvalis

Last Updated:

Views: 6015

Rating: 4.4 / 5 (75 voted)

Reviews: 90% of readers found this page helpful

Author information

Name: Greg Kuvalis

Birthday: 1996-12-20

Address: 53157 Trantow Inlet, Townemouth, FL 92564-0267

Phone: +68218650356656

Job: IT Representative

Hobby: Knitting, Amateur radio, Skiing, Running, Mountain biking, Slacklining, Electronics

Introduction: My name is Greg Kuvalis, I am a witty, spotless, beautiful, charming, delightful, thankful, beautiful person who loves writing and wants to share my knowledge and understanding with you.