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 CenterFile Exchange에서 Discrete Data Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by