Extract X,Y data from scatter plot (2024)

45 views (last 30 days)

Show older comments

Pichawut Manopkawee on 26 Sep 2020

  • Link

    Direct link to this question

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

  • Link

    Direct link to this question

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

Commented: Pichawut Manopkawee on 27 Sep 2020

Accepted Answer: 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 Comments

Show 2 older commentsHide 2 older comments

KSSV on 26 Sep 2020

Direct link to this comment

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

  • Link

    Direct link to this comment

    https://in.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 on 26 Sep 2020

Direct link to this comment

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

  • Link

    Direct link to this comment

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

Edited: Pichawut Manopkawee on 26 Sep 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.

Direct link to this comment

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

  • Link

    Direct link to this comment

    https://in.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 on 26 Sep 2020

Direct link to this comment

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

  • Link

    Direct link to this comment

    https://in.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

Sign in to comment.

Sign in to answer this question.

Accepted Answer

Cris LaPierre on 26 Sep 2020

  • Link

    Direct link to this answer

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

  • Link

    Direct link to this answer

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

Open in 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 Comments

Show 4 older commentsHide 4 older comments

Pichawut Manopkawee on 26 Sep 2020

Direct link to this comment

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

  • Link

    Direct link to this comment

    https://in.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 on 26 Sep 2020

Direct link to this comment

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

  • Link

    Direct link to this comment

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

Edited: Cris LaPierre on 26 Sep 2020

Open in 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 on 26 Sep 2020

Direct link to this comment

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

  • Link

    Direct link to this comment

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

Edited: Cris LaPierre on 26 Sep 2020

Open in 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 on 26 Sep 2020

Direct link to this comment

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

  • Link

    Direct link to this comment

    https://in.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 on 26 Sep 2020

Direct link to this comment

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

  • Link

    Direct link to this comment

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

Edited: Cris LaPierre on 26 Sep 2020

Open in 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 on 27 Sep 2020

Direct link to this comment

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

  • Link

    Direct link to this comment

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

Thank you so much Cris LaPierre

Sign in to comment.

More Answers (0)

Sign in to answer this question.

See Also

Categories

MATLABGraphics2-D and 3-D PlotsData Distribution PlotsScatter Plots

Find more on Scatter Plots in Help Center and File Exchange

Tags

  • scattered data
  • extract value
  • plot

Community Treasure Hunt

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

Start Hunting!

An Error Occurred

Unable to complete the action because of changes made to the page. Reload the page to see its updated state.


Extract X,Y data from scatter plot (13)

Select a Web Site

Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

You can also select a web site from the following list

Americas

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

Europe

  • 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 Pacific

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

Contact your local office

Extract X,Y data from scatter plot (2024)

FAQs

How do you collect data from a scatter plot? ›

Scatter Diagram Procedure

Collect pairs of data where a relationship is suspected. Draw a graph with the independent variable on the horizontal axis and the dependent variable on the vertical axis. For each pair of data, put a dot or a symbol where the x-axis value intersects the y-axis value.

How to use xy extract? ›

How to Extract Data from XY graphs?
  1. Step 1: Uploading the image. We will take the below graph as an example. ...
  2. Step 2: Selecting graph type. ...
  3. Step 3: Calibrating the axes of XY graph. ...
  4. Step 4: Extracting data points. ...
  5. Step 5: Exporting to other file formats.

How do you extract data from a plot? ›

We can extract the data from the graph by following simple steps:
  1. Step 1: Upload the image to PlotDigitizer. ...
  2. Step 2: Select the graph type. ...
  3. Step 3: Calibrating the axes. ...
  4. Step 4: Extracting data points from the plot. ...
  5. Step 5: Exporting the extracted data.

How do you read data from a scatter plot? ›

First, to read a scatter plot, make sure you understand what the independent (x-axis) and dependent variables (y-axis) are measuring. Next, we examine the view to see if we can identify a correlation between fields in the view. If the variables correlate they will fall along a line or curve.

What can we get from scatter plot? ›

Scatter plots' primary uses are to observe and show relationships between two numeric variables. The dots in a scatter plot not only report the values of individual data points, but also patterns when the data are taken as a whole.

What is the XY scatter plot? ›

Often referred to as an xy chart, a scatter chart never displays categories on the horizontal axis. A scatter chart always has two value axes to show one set of numerical data along a horizontal (value) axis and another set of numerical values along a vertical (value) axis.

How to extract data from a graph in Excel? ›

Extracting Data from Chart or Graph
  1. Step 1 : Consider an Excel sheet where you have a chart similar to the below image.
  2. Step 2 : Then click on Insert, select Module, and copy the below code into the text box.
  3. Step 3 : Then save the sheet as a macro−enabled template and click F5 to run the module.
Jul 20, 2023

How to get information from a graph? ›

Get more information from graph data
  1. Determine a point's coordinates.
  2. Drill down in a graph.
  3. Filter the data.
  4. Change the granularity of the data.
  5. View measurement trends.
  6. Auto correlate measurements.
  7. Save graph as image.
Jul 23, 2024

How do I extract data from an image? ›

Extract text from image with Google Drive.
  1. Upload your image or PDF to Google Drive.
  2. Right-click your file in Google Drive and select Open with > Google Docs.
  3. Wait for your file to load and convert. It may take some time, especially if there's a lot of text to convert.

What is the best way to extract data? ›

Here are the top 10 data extraction techniques for organizations to employ according to their business requirements:
  1. Web scraping. ...
  2. API integration. ...
  3. Text pattern matching. ...
  4. Optical character recognition (OCR) ...
  5. Data mining. ...
  6. Natural language processing (NLP) ...
  7. Database querying. ...
  8. System log analysis.

What is plot extraction? ›

Plot extraction is a critical aspect of radar signal processing, enabling the identification and analysis of relevant targets from radar data.

How do you find the data source of a graph? ›

Click the worksheet that contains your chart. Right-click the chart, and then choose Select Data. The Select Data Source dialog box appears on the worksheet that contains the source data for the chart.

How to study a scatter plot? ›

Scatter plots are the graphs that present the relationship between two variables in a data-set. It represents data points on a two-dimensional plane or on a Cartesian system. The independent variable or attribute is plotted on the X-axis, while the dependent variable is plotted on the Y-axis.

How do you interpret a correlation scatter plot? ›

If the data points are following a pattern up from left to right, then the scatterplot is said to be have a positive relationship and be a positive correlation scatterplot; if the data points are following a pattern down from left to right, then the scatterplot is said to have a negative relationship and be a negative ...

How do you read a scatter plot in Excel? ›

To interpret scatter plots in Excel, you need to consider the shape, direction, and strength of the relationship: a linear shape means that the data points form a straight line or close approximation of one; a positive direction means that the data points slope upward from left to right; and a strong strength indicates ...

How is a scatter graph used to present data? ›

A scatter graph is used to investigate a relationship (link) between two pieces of data. Once the data has been plotted the pattern of points describes the relationship between the two sets of data. A line of best-fit should be drawn on the graph after the points have been plotted.

How do I select data for a scatter plot in Excel? ›

Highlight the two columns you want to include in your scatter plot. Then, go to the “Insert” tab of your Excel menu bar and click on the scatter plot icon in the “Recommended Charts” area of your ribbon. Select “Scatter” from the options in the “Recommended Charts” section of your ribbon.

How do you measure scatter data? ›

Research concepts: Quantifying scatter
  1. Calculate the mean (i.e. the average value).
  2. For each data point, calculate the difference between itself and the mean.
  3. Square each of these differences.
  4. Add up the squared differences.
Jun 11, 2019

Top Articles
Latest Posts
Recommended Articles
Article information

Author: Fr. Dewey Fisher

Last Updated:

Views: 5269

Rating: 4.1 / 5 (62 voted)

Reviews: 85% of readers found this page helpful

Author information

Name: Fr. Dewey Fisher

Birthday: 1993-03-26

Address: 917 Hyun Views, Rogahnmouth, KY 91013-8827

Phone: +5938540192553

Job: Administration Developer

Hobby: Embroidery, Horseback riding, Juggling, Urban exploration, Skiing, Cycling, Handball

Introduction: My name is Fr. Dewey Fisher, I am a powerful, open, faithful, combative, spotless, faithful, fair person who loves writing and wants to share my knowledge and understanding with you.