如何在MATLAB中设置自定义默认色彩映射? [英] How do you set a custom default colormap in MATLAB?

查看:755
本文介绍了如何在MATLAB中设置自定义默认色彩映射?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人在其他地方提出这个问题,被告知有一个提示此处 ,但我对MATLAB很陌生,没有看到如何使用这个提示。

Someone asked this question elsewhere and was told there was a 'hint' here, but I'm quite new to MATLAB and don't see how to use that hint.

我有一个文件 cmap.mat 。我加载它并更新颜色映射如下:

I have a file cmap.mat. I load it and update the colormap as follows:

load cmap.mat;
colormap(cmap);

但它只适用于当前数字。

But it only works for the current figure. I'd like all figures to use this colormap.

推荐答案

要设置所有数字将使用的默认属性,您必须请在根对象上设置该默认值。 这里有一些更好的文档说明了如何做。在你的情况下,你会做以下:

To set a default property that all figures will use, you have to set that default value on the root object. Here's some better documentation explaining how to do it. In your case, you would do the following:

set(0,'DefaultFigureColormap',cmap);

一般来说,您必须设置的属性名称将是默认'后跟句柄对象名称(即'Figure''Line''Surface'等),然后是您为其设置默认值的属性名称。一旦设置,将创建后续处理对象,并将该属性设置为您指定的默认值。

In general, the property name you have to set will be the word 'Default' followed by the handle object name (i.e. 'Figure', 'Line', 'Surface', etc.) followed by the property name you are setting the default for. Once set, subsequent handle objects will be created with that property set to your specified default.

注意:最后是当前的MATLAB会话。如果重新启动MATLAB,默认值将恢复为出厂设置。要在每次启动MATLAB时使用相同的默认值,请在 启动中应用它们。 m'文件

Note: The default property values you set will only last for the current MATLAB session. If you restart MATLAB, the default values will revert to their factory settings. To use the same defaults every time you start MATLAB, apply them within your 'startup.m' file.

这篇关于如何在MATLAB中设置自定义默认色彩映射?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆