使用命令行在MATLAB中设置图的背景颜色? [英] Setting the background color of a plot in MATLAB using the command line?
问题描述
我为我的编程类做了一个赋值,我需要创建一个plot,以及一个最适合几个数据点的线,只使用MATLAB中的命令行。我知道如何使用图编辑器设置背景,但我不能为我的生活弄明白如何通过命令行。我需要将其设置为黄色。我该怎么做?我想我只是缺少一些简单的东西。
I am doing an assignment for my programming class, and I need to create a plot, along with a line of best fit for a few data points using only the command line in MATLAB. I know how to set the background using the figure editor, but I cannot for the life of me figure out how to do it via the command line. I need to set it to yellow. How would I do this? I think I am just missing something simple.
推荐答案
解决你的specifiec问题,由@ M.Huster。我会告诉你如何在这些情况下帮助自己。
The solution to your specifiec question, is given by @M.Huster. I will just show you how you can help yourself in these cases.
只需制作图表,然后应用您想要的任何手动更改即可。然后,在图形窗口中,选择文件菜单中的生成代码选项。这将生成一个m文件,它接收一个数据集并重新创建该数据集的数字。如果你看看那个代码(通常很容易阅读),你会看到什么命令对某种效果负责。
Just make your plot and apply any manual changes you'd like. Then, in the figure window choose the option "Generate Code" in the File menu. This will generate an m-file that takes a dataset and recreates the figure for that dataset. If you look at that code (which is generally quite readable), you will see what commands are responsible for a certain effect.
As @ M.Huster说,使用 get
获得属性,更多的图形方式是使用 inspect(gca)
,更好的是 uiinspect
命令。
As @M.Huster said, you can use get
to get the properties, a more graphic way is using inspect(gca)
and even better is the uiinspect
command written by Yair Altman.
这篇关于使用命令行在MATLAB中设置图的背景颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!