MATLAB: How to make scatter plots change size after certain value range

MATLABmatlab functionscatter points

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 ^^

Best Answer

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.