Hi,
I understand that you are trying to visualize the changes across 15 cities for three different scenarios using MATLAB.
- 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:
% 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:

