Brush Tool Only Exports x and y data. Is there a way to export size?

5 views (last 30 days)
I am trying to save the x, y, and size of scatterpoint from my brushed data (only the x and y data saves). Is there a way to do this? Thank you for the help!
If not is there a way to find in my [1048575x10 double] the tenth column that corresponds to two columns.
Ex:
A B C D E F G H I J
1 2 3 4 5 6 7 8 9 10
6 3 7 9 5 3 2 5 6 7
given a 2 x 2 double:
3 4
4 9
I would get out
10
7
Thank you!
  1 Comment
Kate
Kate on 17 Jan 2024
Is there away to hold a fifth variable in each point of the scatterplot? And also export this?

Sign in to comment.

Answers (1)

SAI SRUJAN
SAI SRUJAN on 22 Jan 2024
Hi Kate,
I understand that you are working with a 'scatter' plot and have used a 'brush' tool to select certain points within it. The 'brush' tool you're using currently only allows you to save the 'x' and 'y' coordinates of the selected data points, However, you also wish to capture an additional attribute, the size of each point.
Here's an example of the code used to generate the plot:
% Example data
x = [1, 2, 3, 4, 5];
y = [5, 4, 3, 2, 1];
sizes = [10, 20, 30, 40, 50]; % Sizes for scatter points
% Create the scatter plot
s = scatter(x, y, sizes);
brush('on')
To determine the size of each data point selected with the 'brush' tool, please apply the following workaround. After utilizing the 'brush' to highlight the desired scatter points, execute the following command in the command window.
brushedIndices = find(s.BrushData);
This command will create a variable in the workspace that holds the indices of the brushed scatter points. With these indices, you can then extract the corresponding 'x', 'y', and scatter size values for each selected point by indexing into the original data arrays.
For a comprehensive understanding of the 'brush' function in MATLAB, please refer to the following documentation.
I hope this helps!

Products


Release

R2023b

Community Treasure Hunt

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

Start Hunting!