How to make Xaxis (y=0) black in grid

조회 수: 36 (최근 30일)
Silvia
Silvia 2014년 8월 18일
댓글: Silvia 2014년 8월 18일
I have a plot with grid and I would like to have just the Xaxis, y=0, darker so that it is more evident in the graph. How can I do it?
Many thanks

채택된 답변

Hikaru
Hikaru 2014년 8월 18일
Not sure if this is exactly what you want to do, but instead of making it darker, why not making it thicker?
x = [1, 2, 3, 4, 5];
y = [0, 0, 0, 0, 0];
plot(x,y,'k', 'LineWidth', 3) % 'k' for black, and you can adjust the linewidth accordingly.

추가 답변 (1개)

Dishant Arora
Dishant Arora 2014년 8월 18일
You can change axis color by changing the xcolor or ycolor property of axis:
h = gca;
set(h , 'ycolor' , [1,1,1]);
set(h , 'ygrid' , 'on'); % Set only Y - Grids to property on, you'll not see X - Grid
  댓글 수: 1
Silvia
Silvia 2014년 8월 18일
Sorry but if I use this code the x-axis grid becomes white. Anyway, if I set the color to black it just appears the normal dashed grid. I need to make just y=0 as a black continuous line, while all the rest of the grid haas to remain dashed.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Graphics Object Properties에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by