主要内容

刷子

互动标记图表中的数据值

描述

数据刷牙使您可以使用选择的颜色在图表中标记数据值。您可以标记单个数据值,或选择许多值使用选择矩形标记的值。标记值后,您可以将它们删除或将其保存到工作空间中的变量。刷子标记将一直持续到您删除它们,即使您平移,缩放,添加数据提示或编辑图。

大多数图表都支持数据刷牙金宝app,包括线,条,区域,直方图和表面图。支持刷牙的图表通常显示刷金宝app子图标in the axes toolbar.

创建

描述

例子

turns on brushing in the current figure. With brushing on, mark a single data value by clicking on it. Mark multiple data values by dragging a selection rectangle around them. To add additional marks or remove unwanted marks, hold the转移刷刷值时键。

刷牙关闭刷牙。如果图表上有现有的刷子标记,则此命令将不会删除它们。

刷子切换刷牙模式'上'and'离开'

刷子((颜色sets the color for subsequent brush marks. Setting the brush color does not affect current marks unless you brush data, change the brush color, and then add or remove marks using the转移钥匙。在这种情况下,所有标记都更新为新颜色。

刷子((,,,,___sets brush mode or color options for the specified figure. For example,刷子(无花果,'on')

例子

b= brush(___创建一个刷子目的。该语法对于控制画笔模式,颜色和回调属性很有用。

输入参数

展开全部

目标图,,,,specified as aFigure目的。如果您不指定图,则刷牙会影响当前图。

刷子标记颜色,指定为RGB三重态或颜色名称。要创建特定颜色的刷子标记,请在刷取数据值之前设置颜色属性。设置刷子颜色不会影响电流标记,除非您刷数据,更改刷子颜色,然后使用该标记添加或删除标记转移钥匙。在这种情况下,所有标记都更新为新颜色。

An RGB triplet is a three-element row vector whose elements specify the intensities of the red, green, and blue components of the color. The intensities must be in the range[0,1];for example,[0.4 0.6 0.7]。另外,您可以按名称指定一些常见的颜色。该表列出了长颜色名称选项及其等效的RGB三重态值。

颜色名称 简称 RGB三胞胎 Appearance
'红色的' 'r' [1 0 0]

颜色红色样品

'绿色' 'G' [0 1 0]

颜色绿色样品

'蓝色的' 'b' [0 0 1]

蓝色样品

'cyan' 'C' [0 1 1]

颜色青色样品

'品红' 'M' [1 0 1]

颜色洋红色样品

'黄色' 'y' [1 1 0]

黄色样品

'黑色的' 'K' [0 0 0]

Sample of the color black

'白色的' 'W' [1 1 1]

颜色样品白色

这是默认颜色MATLAB的RGB三胞胎®uses in many types of plots.

RGB三胞胎 Appearance
[0 0.4470 0.7410]

RGB三重态样品[0 0.4470 0.7410],显示为深蓝色

[0.8500 0.3250 0.0980]

RGB三重态样品[0.8500 0.3250 0.0980],如深橙色

[0.9290 0.6940 0.1250]

Sample of RGB triplet [0.9290 0.6940 0.1250], which appears as dark yellow

[0.4940 0.1840 0.5560]

RGB三重态样品[0.4940 0.1840 0.5560]

[0.4660 0.6740 0.1880]

RGB三重态样品[0.4660 0.6740 0.1880],该样本如中等绿色

[0.3010 0.7450 0.9330]

RGB三胞胎样品[0.3010 0.7450 0.9330],如浅蓝色

[0.6350 0.0780 0.1840]

RGB三重态样品[0.6350 0.0780 0.1840],看起来为深红色

特性

展开全部

Brush mark color, specified as an RGB triplet, a hexadecimal color code, a color name, or a short name. To create brush marks of a certain color, set the color property before brushing your data values. Setting the brush color does not affect current marks unless you brush data, change the brush color, and then add or remove marks using the转移钥匙。在这种情况下,所有标记都更新为新颜色。

For a custom color, specify an RGB triplet or a hexadecimal color code.

  • An RGB triplet is a three-element row vector whose elements specify the intensities of the red, green, and blue components of the color. The intensities must be in the range[0,1];for example,[0.4 0.6 0.7]

  • 十六进制的颜色代码是字符向量或字符串标量,以哈希符号开头(),然后是三个或六个十六进制的数字,范围从0toF。The values are not case sensitive. Thus, the color codes'#FF8800',,,,'#ff8800',,,,'#F80',,,,and'#f80'是等效的。

另外,您可以按名称指定一些常见的颜色。This table lists the named color options, the equivalent RGB triplets, and hexadecimal color codes.

颜色名称 简称 RGB三胞胎 十六进制的颜色代码 Appearance
'红色的' 'r' [1 0 0] '#ff0000'

颜色红色样品

'绿色' 'G' [0 1 0] '#00ff00'

颜色绿色样品

'蓝色的' 'b' [0 0 1] '#0000FF'

蓝色样品

'cyan' 'C' [0 1 1] '#00ffff'

颜色青色样品

'品红' 'M' [1 0 1] '#ff00ff'

颜色洋红色样品

'黄色' 'y' [1 1 0] '#ffff00'

黄色样品

'黑色的' 'K' [0 0 0] '#000000'

Sample of the color black

'白色的' 'W' [1 1 1] '#ffffff'

颜色样品白色

'没有任何' 不适用 不适用 不适用 没有颜色

这是MATLAB在许多类型的图中使用的默认颜色的RGB三重态和十六进制颜色代码。

RGB三胞胎 十六进制的颜色代码 Appearance
[0 0.4470 0.7410] '#0072BD'

RGB三重态样品[0 0.4470 0.7410],显示为深蓝色

[0.8500 0.3250 0.0980] '#D95319'

RGB三重态样品[0.8500 0.3250 0.0980],如深橙色

[0.9290 0.6940 0.1250] '#EDB120'

Sample of RGB triplet [0.9290 0.6940 0.1250], which appears as dark yellow

[0.4940 0.1840 0.5560] '#7E2F8E'

RGB三重态样品[0.4940 0.1840 0.5560]

[0.4660 0.6740 0.1880] '#77AC30'

RGB三重态样品[0.4660 0.6740 0.1880],该样本如中等绿色

[0.3010 0.7450 0.9330] '#4dbeee'

RGB三胞胎样品[0.3010 0.7450 0.9330],如浅蓝色

[0.6350 0.0780 0.1840] '#a2142f'

RGB三重态样品[0.6350 0.0780 0.1840],看起来为深红色

刷牙模式,指定为'离开'or'上'

刷牙之前执行的功能,,,,specified as one of these values:

  • 功能句柄

  • 包含功能句柄和其他参数的单元格数组

  • 角色向量是有效的MATLAB命令或函数,在基本工作区中评估(不建议)

当您开始刷图时,请使用此属性执行代码。如果使用函数句柄指定此属性,则在执行回调时,MATLAB将两个参数传递给回调函数:

  • 数字- 图对象您正在刷牙。

  • 轴结构- 包含您刷轴的结构。该结构有一个字段,,,,,the axes object you are brushing. If you do not use this argument in your callback function, then replace it with the tilde character ()。

For more information about how to use function handles to define callback definitions, seeCallback Definition

刷牙后执行的功能,,,,specified as one of these values:

  • 功能句柄

  • 包含功能句柄和其他参数的单元格数组

  • 角色向量是有效的MATLAB命令或函数,在基本工作区中评估(不建议)

完成刷牙后,使用此属性执行代码。如果使用函数句柄指定此属性,则在执行回调时,MATLAB将两个参数传递给回调函数:

  • 数字- 图对象您正在刷牙。

  • 轴结构- 包含您刷轴的结构。该结构有一个字段,,,,,the axes object you are brushing. If you do not use this argument in your callback function, then replace it with the tilde character ()。

For more information about how to use function handles to define callback definitions, seeCallback Definition

刷抑制回调,指定为th之一ese values:

  • 功能句柄

  • 包含功能句柄和其他参数的单元格数组

  • 角色向量是有效的MATLAB命令或函数,在基本工作区中评估(不建议)

Use this property to suppress brushing under conditions that you define. A numeric or logical output of 1 (true)抑制刷子动作,以及0的数字或逻辑输出(错误的)allows the brush action to proceed. If you specify this property using a function handle, then MATLAB passes two arguments to the callback function when executing the callback:

  • - 您要刷的轴对象。

  • EventData- 空论点。用tilde角色替换它()在函数定义中,指示未使用此参数。

If you specify this property using a function handle, then you must assign the function's output to a variable.

For more information about how to use function handles to define callback definitions, seeCallback Definition

此属性仅阅读。

Figure目的in which brush marks appear.

遗产模式,指定为'上'or'离开',或数字或逻辑1((true) 或者0((错误的)。A value of'上'等同于true,,,,and'离开'等同于错误的。因此,您可以将此属性的值用作逻辑值。该值存储为类型的ON/OFF逻辑值matlab.lang.onoffswitchstate

Setting this property to'上'改变UI图中交互模式的行为,使它们与传统图中的模式的行为匹配。有关更多信息,请参阅EnableGacyE​​xplorationModes

一旦将此属性设置为'上',它不能更改回'离开'

此属性仅适用于使用该图创建的数字的刷子对象uifigure功能或INMATLABOnline™

例子

全部收缩

Use brushing to mark data values in a scatter plot. First, plot randomXandy值。Then, turn on brushing and use the mouse to drag a rectangle around some points.

x = rand(20,1);y = rand(20,1);散射(x,y)刷('上'

Scatter plot with a rectangle surrounding some points. The surrounded points have a red fill instead of no fill.

To modify which points you have marked without discarding the entire set, hold down the转移刷牙时钥匙。单击它添加或删除单点。通过拖动选择矩形来添加或删除几个点。

Scatter plot with a red rectangle surrounding a different group of points. Points in both groups have a red fill.

通过单击或拖动在轴的空区域中清除所有刷子标记。

在条形图中绘制数据值并创建画笔对象。然后,启用刷牙并将刷子颜色设置为'绿色'byupdating the object's properties. Finally, mark data values by including the maximum value of each bar in the selection rectangle.

y = [75 91 105 123.5 131 150 179 203 226 249 281.5];bar(y)b =刷子;b.enable ='上';b.Color ='绿色';

条形图带有矩形,围绕某些条的最大值。选定的条具有绿色填充而不是蓝色填充物。

使用上下文菜单将拉丝数据保存在变量中。首先,绘制一些Xandy值。打开刷牙,然后标记一些数据值。

x = linspace(0,5,30);y = exp(x);plot(x,y) brush('上'

线图周围有一个矩形。矩形中的线和数据值以红色突出显示。

将拉丝数据存储在变量中,右键单击拉丝数据值,然后选择出口刷从上下文菜单。提示时,输入变量名称。在这种情况下,使用名称bdata。Finally, view the contents ofbdata

bdata
bdata = 3.2759 26.4660 3.4483 31.4461 3.6207 37.3633 3.7931 44.3940 3.9655 52.7475 4.1379 62.679 62.6730 4.3103 74.4662

使用上下文菜单从图表中删除图表。首先,绘制一些Xandy值。打开刷牙,然后标记一些数据值。

x = linspace(0,5,30);y = exp(x);散射(x,y)刷('上'

Scatter plot with a rectangle surrounding some points. The selected points have a red fill instead of no fill.

要从图表中删除拉丝数据,请右键单击拉丝数据值,然后选择消除从上下文菜单。

更新的散点图。选定的点已经消失了。

Limitations

使用上下文菜单更改刷子标记的颜色,不支持使用该图创建的数字金宝appuifigure功能。相反,创建一个刷子模式对象,然后编程更改其颜色。

uif = uifigure;ax = axes(uif);bar(ax,1:10)b =刷子(UIF);b.Color ='G';b.enable ='上';

更多关于

展开全部

提示

  • 要刷直方图图表,您必须首先打开数据链接。

版本历史记录

在R2008A中引入