Include the name of each category in x-axis in a Plot

3 次查看(过去 30 天)
Can anyone please help me on how to show the name of each category on a MATLAB plot. I know I can do it on a Bar chart but I need to use plot instead. I have tried to use categorical but when I changed their names, the graph was plotted wrongly. This what I have
if true
% code
c = categorical({'M';'M+2S';'M+S';'M-2S';'M-S';'P10';'P50';'P90'});
Objective_Rank rand(1,8)
plot(c,Objective_Rank))
end
I found later I wanted to name the category with different name such as {'2M';'M+S';'M+2S';'M-2S';'M-S';'P10';'P50';'P90'} after I have changed the Objective_Rank's elements positions. Can anyone help please.

采纳的回答

Yaser Khojah
Yaser Khojah 2018-10-8
if true
% code
f(j) = figure;
% Create axes
axes1 = axes('Parent',f(j));
hold(axes1,'on');
plot(Objective_Rank(j,:))
title(['Demand ' num2str(Demand) ' MMSCFD - Reservoir Uncertaintiy with ' num2str(Percent(j)) '% STD (Log Normal)'])
box(axes1,'on');
% Set the remaining axes properties
set(axes1,'XTick',[1 2 3 4 5 6 7 8],'XTickLabel',...
{'M-2S','P10','M-S','M','P50','M+S','P90','M+2S'});
end

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 2-D and 3-D Plots 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by