plot tools:add data color
48 views (last 30 days)
Show older comments
the default color is blue,but i want to make the color of the data added black,so how to make it?

0 Comments
Accepted Answer
AJ von Alt
on 22 Jan 2014
If you want to make the line black at the time of plotting, add the argument 'k' to the plot command.
Example:
figure;
x = 0:0.1:10;
y = sin( x );
plot( x , y , 'k');
If you have a line that is blue and you want to make it black, you can use findobj to get the handle of the blue line and then set its color property value to black manually.
Example:
% plot something
figure;
x = 0:0.1:10;
y = sin( x );
plot( x , y , 'Blue' );
% the color values for blue and black
blue = [ 0 0 1 ];
black = [ 0 0 0 ];
% get the handle for the blue line
hline = findobj( gca , 'color' , blue );
% Set the line's color property value to black
set( hline(1) , 'color' , black )
More Answers (1)
See Also
Categories
Find more on Graphics Object Identification in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!