How to make scatter plots change size after certain value range

4 views (last 30 days)
Hey, I need help with some matlab.
Had made a Matlab script over precipitation data as well as tree locations and now having the problem with my last infromation (tree thickness) which needed to be implemented with the other data in a 2D map function.
Cant seem to make it work so the points, which shows tree locations, change size depending on the thickness of each tree. So its like a second scale in the 2D map. Have uploaded the script and the information that needs to be included.
(just ignore the green texts, just notes for me in danish because just started learning the program)
Hope you guys can help me ^^

Accepted Answer

Uday Pradhan
Uday Pradhan on 12 Aug 2020
Hi Lukas,
In my understanding, you want to plot a scatter plot of the locations of trees from their text data files such that the size of the scattered points varies according to the thickness of the trees.
This can be done using the “scatter” plot function as it can plot points with varying sizes if a third vector of scalar values is provided which has the same number of elements as the vectors being plotted. I have assumed that the location and thickness information of the trees is given in the file “TreeAndSize_data_SiteA.txt”. With this assumption, we can get the required plot as follows:
fil = load('TreeAndSize_data_SiteA.txt');
scatter(fil(:,1),fil(:,2),fil(:,3) * k,'filled');
% Assuming that the first, second and third columns are locations and thickness respectively.
% Vary "k” to get different point scales.
For more options, please refer to the scatter plot documentation.
  1 Comment
Lukas Samuelsen
Lukas Samuelsen on 14 Aug 2020
Thanks for help ^^
I dont know why i couldnt make it work when it was so simple to do. Guess that i got lost when trying all kind of methods.

Sign in to comment.

More Answers (0)

Products


Release

R2020a

Community Treasure Hunt

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

Start Hunting!