Stacked bar plot for negative ambient .
8 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I have the components simulation data at -30C and steady bias , maneuver rise and margin (calculeted from given Tmax of each compoenent) to be plotted in stacked bar format ,
in the positive ambient the plots works fine but in negative ambient , the steady bias is starting from 0 (lets say @-30C , component setad bais is 6C , then it should start from -24C ?. see attched image .
please suggest the better ways to handle .
Thank you .
2 commentaires
dpb
le 13 Août 2025
@Anil it would be helpful to have the data
If the baseline for each bar is the same, then the suggestion of @Chuguang Pan should work for you straightforwardly.
But, the 'BaseValue' is one value for the whole plot, not on a bar-by-bar basis, so in that case you may have to get creative and either draw each bar individually with its own baseline value (I've not ever tried this) or rescale the data to be positive and then manually set the axes tick values to the desired values.
If the latter is the case, it would be most helpful to have the data and a more complete description of just how you would want the plot to look.
Réponses (1)
Cris LaPierre
le 13 Août 2025
Déplacé(e) : Cris LaPierre
le 16 Août 2025
It would be helpful to see the code you used to create the plot. It appears that Tamb has been set to -30, so when creating a stacked bar chart, the first level is the same for all bars - a bar that goes from -30 to 0.
Tamb = -30*ones(5,1);
Bias = randi(20,[5,1]);
Rise = randi(40,[5,1]);
Margin = randi(200,[5,1]);
bar([Tamb Bias Rise Margin],'stacked')
legend("Tamb","Steady Bias","Maneuver Rise","Margin")
ylabel('Temperature')
Not exacty sure what you want, but using a bar to indicate Tamb doesn't seem right. Setting the BaseValue doesn't quite do what I would expect. Here's what I could come up with.
Tamb = -30;
bar([Bias Rise Margin],'stacked')
legend("Steady Bias","Maneuver Rise","Margin")
ylabel('Temperature')
yticklabels(Tamb+yticks)
3 commentaires
Adam Danz
le 3 Nov 2025 à 16:53
Just catching up here. The OP's goal and problem isn't clear to me -- I wonder if Cris' solution solved it.
Voir également
Catégories
En savoir plus sur Title dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

