How can I change Center Line, LCL, and UCL linestyles in controlchart for xbar and R charts.

10 views (last 30 days)
I want to modify Shewhart Xbar and R control chart formats to work in greyscale. How can I change the line styles and colors for the Center Line, LCL, and UCL? I need them to be accessible for color blind users and cheap to print. (I'm a self taught Matlab beginner trying to teach it to undergrads...I am not trying to get you to do my homework for me.)
stats = controlchart(WeightsRevisedRows1_21_23_25,ChartType=["xbar","r"])

Answers (1)

Mathieu NOE
Mathieu NOE ungefär 19 timmar ago
hello Peggy
maybe try this
% Example: Create a control chart
data = randn(30,4); % Example data
controlchart(data);
% Access the chart's graphical elements
chart = gca; % Get current axes
lines = chart.Children % Access chart elements (lines, markers, etc.)
lines =
4×1 Line array: Line (lclucl) Line (cl) Line (ooc) Line (pts)
% Change the color of specific elements
Lightgray =[0.8, 0.8, 0.8];
Mediumgray = [0.5, 0.5, 0.5];
Darkgray = [0.2, 0.2, 0.2];
Black = [0, 0, 0];
lines(1).Color = Darkgray; % Change the first line to Dark gray
lines(2).Color = Lightgray; % Change the second line to Light gray
lines(3).Color = Mediumgray; % Change the second line to Medium gray
lines(4).Color = Black; % Change the second line to black

Categories

Find more on Polar Plots in Help Center and File Exchange

Products


Release

R2025a

Community Treasure Hunt

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

Start Hunting!