フィルターのクリア

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

2 ビュー (過去 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 Center および File ExchangeSurface and Mesh Plots についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by