- Based on your description of the problem, a “grouped bar chart” would be an effective way to compare the values across different cities for each scenario.
- We need to ensure that there is a clear differentiation between cities and scenarios. Refer to the following MATLAB script for the same:
Sensitivity Analysis- Plot
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I want to plot a graph that would have multiple cities (city 1 to 15) on the y-axis and about 3 scenarios on the x-axis (I have the values for the cities corresponding to the different scenarios).
The goal here is to visualize the changes in the 15 sectors across the three different scenarios.
Please, can anyone suggest the plots that would be best for this?

0 comentarios
Respuestas (1)
Riya
el 1 de Abr. de 2025
Hi,
I understand that you are trying to visualize the changes across 15 cities for three different scenarios using MATLAB.
% Sample data
cities = 1:15; % 15 cities
scenarios = 1:3; % 3 scenarios
data = rand(15, 3) * 10; % Random values representing different scenarios
% Create the grouped bar chart
figure;
bar(data);
% Customize the plot
xlabel('Cities');
ylabel('Values');
title('Sensitivity Analysis - Multiple Cities Across Scenarios');
legend({'Scenario 1', 'Scenario 2', 'Scenario 3'}, 'Location', 'northwest');
xticks(1:15);
xticklabels(arrayfun(@(x) sprintf('City %d', x), cities, 'UniformOutput', false));
grid on;
The “bar(data)” function plots a grouped bar chart where each city has three bars, one for each scenario, and the “legend({'Scenario 1', 'Scenario 2', 'Scenario 3'})” would ensure that there is proper labelling of the scenarios.
For further reference on the “bar” function, refer to the official MATLAB documentation:
0 comentarios
Ver también
Categorías
Más información sobre Polar Plots en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!