Clear Filters
Clear Filters

how to change colour of line and checkbox background colour assigned to it.

1 view (last 30 days)
Hi i have 3 lines and 3 checkboxes in my graph.and i have assigned line handle to individual checkbox and attached contextmenu to lines and i can change colour of lines by using context requirement is when i change colour of line ,background colour of checkbox assigned to it should also get changed and should be same as line colour.i have created checkboxes using guide.please help
x = 0:20;
N = numel(x);
y1 = rand(1,N);
y2 = 5.*rand(1,N)+5;
y3 = 50.*rand(1,N)-50;
%# Some initial computations:
axesPosition = [110 40 200 200]; %# Axes position, in pixels
yWidth = 30; %# y axes spacing, in pixels
xLimit = [min(x) max(x)]; %# Range of x values
xOffset = -yWidth*diff(xLimit)/axesPosition(3);
%# Create the figure and axes:
figure('Units','pixels','Position',[200 200 330 260]);
h1 = axes('Units','pixels','Position',axesPosition,...
'XLim',xLimit,'YLim',[0 1],'NextPlot','add');
h2 = axes('Units','pixels','Position',axesPosition+yWidth.*[-1 0 1 0],...
'XLim',xLimit+[xOffset 0],'YLim',[0 10],...
h3 = axes('Units','pixels','Position',axesPosition+yWidth.*[-2 0 2 0],...
'XLim',xLimit+[2*xOffset 0],'YLim',[-50 50],...
%# Plot the data:

Answers (0)

Community Treasure Hunt

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

Start Hunting!