How to set different background color for differnt rigion of the figure?

조회 수: 6 (최근 30일)
zzzhhh
zzzhhh 2016년 9월 17일
답변: Image Analyst 2016년 9월 17일
I want to draw a plot figure in which the rectangular background region corresponding to x-coordinate [1, 100] has a red color, [101, 150] has a blue color and [151, 220] has a green color. This thread proposes a method to set background color but it only sets the whole background of the plot. Is it possible to set different part of the background with different color? Thanks a lot!

답변 (1개)

Image Analyst
Image Analyst 2016년 9월 17일
You can get the y limits using ylim(), then you can use patch(), fill(), or rectangle() to draw different colored rectangles knowing those x ranges and y ranges.

카테고리

Help CenterFile Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by