How can I color the area under a histfit curve?
3 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hello everyone, I am trying to make in Matlab a plot called heated density plot in R that is basically a smoothed histogram whose area under the curve is colored accordingly to the belonging to a certain "bin". Can everyone help me doing this? I would really appreciate this. I attach an example of what the outcome should look like more or less. Thank you
0 Commenti
Risposta accettata
Tala
il 29 Mag 2021
I assume you have an array that contains the envelope of your curve. If yes, this should help you! something like:
section1=1:0.1:2;
section2=2:0.1:3;
area(section1,yourarray);
hold all
area(section2,yourarray);
1 Commento
Più risposte (1)
DGM
il 30 Mag 2021
Modificato: DGM
il 30 Mag 2021
I have no familiarity with violin plots or your data, and I don't know which violin plot tools you chose to use. If you're trying to essentially control the resolution of your colormap, consider a simplified example:
x = 1:100;
y = 1:100;
nbins = 5;
% find which bin each point belongs in
[~,~,idx] = histcounts(y,nbins);
% start with a reduced colormap
cmap = jet(nbins);
% combine to get cdata
scatter(x,y,[],cmap(idx,:))
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/636505/image.png)
I don't know if that's helpful in your case.
0 Commenti
Vedere anche
Categorie
Scopri di più su Discrete Data Plots in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!