how to plot each bin of data individually?
Afficher commentaires plus anciens
I am having the follwoing issues:
I have a table with three variables: time in hours, altitude and solar activity, according to a time interval of 3hrs I have divided my data into 8 bins using the function discretize.
How can we plot the data within each bin indiviually, i.e we have 8 bins we would like to have a graph for each bin, that is for each interval of time, so at the end we get 8 graphs.
in the plot the data of each row sholud be presented for ex by a dot.
attached is a text file containing a sample of the data I am working with.
Réponse acceptée
Plus de réponses (2)
dpb
le 18 Oct 2021
OK, here's another example; I'll add it as its own Answer -- carrying on from the above
uBin=unique(tD.Bin);
for i=uBin(:).'
nexttile
isBin=(tD.Bin==i);
scatter(tD.NE8(isBin),tD.GDALT(isBin),'.')
legend("Bin "+i,'Location','best')
xlabel('NE, units'),ylabel('GDALT, ft')
box on
end

1 commentaire
MA
le 19 Oct 2021
Steven Lord
le 18 Oct 2021
0 votes
Can you tell us which of the thumbnail pictures for the plotting functions included in MATLAB look closest to what you want to plot? If none of them do and you have other MathWorks toolboxes installed, open the Plots tab on the Toolstrip and see if any of the functions from a toolbox have thumbnails that look closer (maybe a boxplot from Statistics and Machine Learning Toolbox?)
6 commentaires
MA
le 18 Oct 2021
Steven Lord
le 18 Oct 2021
dpb
le 18 Oct 2021
I guess I thought it would be self-evident how to do one at a time; presumed you had something far more exotic in mind..
isBin=(tD.Bin==1);
scatter(tD.NE8(isBin),tD.GDALT(isBin),'.')
legend('Bin 1','Location','southeast')
box on
produces

Simply pick the bin number of interest and do logical addressing to extract those elements with that specific bin.
Obviously you could wrap this in a little 2-3 line function so just give it the number of interest.
MA
le 18 Oct 2021
dpb
le 18 Oct 2021
It's easy to overthink a problem, indeed... :)
Glad to help.
Investigate rowfun and friends if you do other analyses on these data by the grouping variable(s) -- extremely powerful construct for such purposes.
MA
le 19 Oct 2021
Catégories
En savoir plus sur 2-D and 3-D Plots dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
