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

4 ビュー (過去 30 日間)
Yaser Khojah
Yaser Khojah 2018 年 10 月 8 日
回答済み: Yaser Khojah 2018 年 10 月 8 日
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 Center および File ExchangeDiscrete Data Plots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by