Default plot apperance... how do I change it??

In all the examples there are nice looking plots with simple white backgrounds and axes that encompass the figure.
In my plots the background is gray and the axes are only on two sides.
Any ideas how to fix this so EVERY 'plot' command produces nice figures, without typing the same thing in every script... for example: set(gcf,'Color',[1,1,1])
Thanks

回答 (2 件)

Matt Fig
Matt Fig 2011 年 5 月 26 日

1 投票

In your startup file, put the defaults.
set(0,'defaultfigurecolor',[1,1,1])
set(0,'defaultaxescolor',[1 1 1])
...etc
If you don't have a startup file, just make one and make sure it is on your path. MATLAB will execute this file every time it starts, so any commands in there will run before you even do anything.
The other option is to put all the plot customization commands into an M-file, then call the M-file after you plot. For example, in an M-file named MYPLOTFORMAT, you put this:
set(gcf,'color',[1,1,1])
set(gca,'color',[1 1 1])
...etc
Then,
plot(1:10) % Make a plot
myplotformat % Apply custom formatting
Patrick Kalita
Patrick Kalita 2011 年 5 月 27 日

0 投票

This doc page covers the process pretty well.

カテゴリ

ヘルプ センター および File ExchangeCreating, Deleting, and Querying Graphics Objects についてさらに検索

質問済み:

Wes
2011 年 5 月 26 日

Community Treasure Hunt

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

Start Hunting!

Translated by