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

8 visualizaciones (últimos 30 días)
Kate
Kate el 17 de En. de 2024
Respondida: SAI SRUJAN el 22 de En. de 2024
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 comentario
Kate
Kate el 17 de En. de 2024
Is there away to hold a fifth variable in each point of the scatterplot? And also export this?

Iniciar sesión para comentar.

Respuestas (1)

SAI SRUJAN
SAI SRUJAN el 22 de En. de 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!

Categorías

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

Productos


Versión

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by