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

4 Ansichten (letzte 30 Tage)
Yaser Khojah
Yaser Khojah am 8 Okt. 2018
Beantwortet: Yaser Khojah am 8 Okt. 2018
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.

Akzeptierte Antwort

Yaser Khojah
Yaser Khojah am 8 Okt. 2018
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

Weitere Antworten (0)

Kategorien

Mehr zu Discrete Data Plots finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by