# [ACCEPTED]-In MATLAB, how do I change the background color of a subplot?-background-color

You can use the set command.

```
set(subplot(2,2,1),'Color','Red')
```

That will give 2 you a red background in the subplot location 1 2,2,1.

I know you mentioned that you are using 10 MATLAB 6.1, but it bears mentioning that 9 in the newer versions of MATLAB you can 8 specify additional property-value pair arguments 7 in the initial call to SUBPLOT, allowing for a 6 more compact syntax. The following creates 5 an axes with a red background in the top 4 left corner of a 2-by-2 layout:

```
subplot(2,2,1,'Color','r');
```

I'm not certain 3 in which version of MATLAB this syntax was 2 introduced, since the release notes going back to Version 7 (R14) don't seem to mention 1 it.

I've not used Matlab in several years, but 3 I think it might well be the whitebg method 2 called after the subplot declaration, similar 1 to the way in which you would set a title.

```
subplot(3, 2, 4), hist(rand(50)), whitebg('y');
```

More Related questions

We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.