MATLAB 的 figure 用法总结

文章目录

  • Syntax:
  • Description
  • Examples
    • 1.figure
    • 2.figure(Name,Value)
      • Position 属性: 设置 Figure 的位置和大小
      • Name 属性: 设置 Figure 的名称
      • NumberTitle 属性: 取消 Figure 名称里默认的数字
      • units 属性
      • color 属性
    • 3.f = figure(___)
    • 4.Working with Multiple Figures Simultaneously
    • 5.figure(f) 和 figure(n)

Syntax:

  • figure
  • figure(Name,Value)
  • f = figure(___)
  • figure(f)
  • figure(n)

Description

1.figure

用法:figure creates a new figure window using default property values. The resulting figure is the current figure.

2.figure(Name,Value)

用法:figure(Name,Value) modifies properties of the figure using one or more name-value pair arguments. For example, figure(‘Color’,‘white’) sets the background color to white.

3.f = figure(___)

用法:f = figure(___) returns the Figure object. Use f to query or modify properties of the figure after it is created.

4.figure(f)

用法:figure(f) makes the figure specified by f the current figure and displays it on top of all other figures.

5.figure(n)

用法:figure(n) finds a figure in which the Number property is equal to n, and makes it the current figure. If no figure exists with that property value, MATLAB creates a new figure and sets its Number property to n.

Examples

1.figure

Create a default figure.

如图:

在这里插入图片描述

2.figure(Name,Value)

Example: figure(‘Color’,‘white’) creates a figure with a white background.

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside single quotes (’ '). You can specify several name and value pair arguments as Name1,Value1,…,NameN,ValueN.

Position 属性: 设置 Figure 的位置和大小

Position 属性的值为一个向量: [left bottom width height].

Location and size of the drawable area, specified as a vector of the form [left bottom width height]. This area excludes the figure borders, title bar, menu bar, and tool bars. (此区域不包括图形边框、标题栏、菜单栏和工具栏。)

ElementDescription
leftright-aligned Distance from the left edge of the primary display to the inner left edge of the window. This value can be negative on systems that have more than one monitor. If the figure is docked, then this value is relative to the Figure panel within the MATLAB desktop. (主显示器左边缘到窗口内左边缘的距离。在具有多个监视器的系统上,此值可能为负值。如果图形停靠,则此值相对于MATLAB桌面中的图形面板。)
bottomDistance from the bottom edge of the primary display to the inner bottom edge of the window. This value can be negative on systems that have more than one monitor. (主显示器底边缘到窗口内底边缘的距离。在具有多个监视器的系统上,此值可能为负值。)
widthDistance between the right and left inner edges of the figure. (图形的左右内边缘之间的距离。)
heightDistance between the top and bottom inner edges of the window. (窗户的上下内缘之间的距离。)

All measurements are in units specified by the Units property.

You cannot specify the figure Position property when the figure is docked.

In MATLAB Online™, the bottom and left elements of the Position vector are ignored.

To place the full window, including the borders, title bar, menu bar, tool bars, use the OuterPosition property.

所有测量的单位都是由units属性指定的。

当图形停靠时,不能指定图形位置属性。

在MATLAB Online™中,位置向量的底部和左侧元素被忽略。

要放置整个窗口,包括边框、标题栏、菜单栏、工具栏,请使用OuterPosition属性。

If the figure is docked, then this value is relative to the Figure panel within the MATLAB desktop. (如果图形停靠,则此值相对于MATLAB桌面中的图形面板。)

在这里插入图片描述

Name 属性: 设置 Figure 的名称

Name — Name
‘’ (default) | character vector | string scalar

Name of the figure, specified as a character vector or a string scalar.

Example: figure(‘Name’,‘Results’) sets the name of the figure to ‘Results’.

By default, the name is ‘Figure n’, where n is an integer. When you specify the Name property, the title of the figure becomes ‘Figure n: name’. If you want only the Name value to appear, set IntegerHandle or NumberTitle to ‘off’.

在这里插入图片描述

NumberTitle 属性: 取消 Figure 名称里默认的数字

在这里插入图片描述

units 属性

Units — Units of measurement

‘pixels’ (default) | ‘normalized’ | ‘inches’ | ‘centimeters’ | ‘points’ | ‘characters’

Units of measurement, specified as one of the values. (测量单位,指定为这些值中的一个值。)

1.‘pixels’ (default): Pixels. Starting in R2015b, distances in pixels are independent of your system resolution on Windows and Macintosh systems:

  • On Windows systems, a pixel is 1/96th of an inch.
  • On Macintosh systems, a pixel is 1/72nd of an inch.

On Linux® systems, the size of a pixel is determined by your system resolution.

2.‘normalized’: These units are normalized with respect to the parent container. The lower-left corner of the container maps to (0,0) and the upper-right corner maps to (1,1). (这些单元相对于父容器是规范化的。容器的左下角映射到(0,0),右上角映射到(1,1)。)

3.‘inches’: Inches.

4.‘centimeters’: Centimeters.

5.‘points’: Points. One point equals 1/72nd of an inch.

6.‘characters’: These units are based on the default uicontrol font of the graphics root object:

  • Character width = width of the letter x.
  • Character height = distance between the baselines of two lines of text.

To access the default uicontrol font, use get(groot,‘defaultuicontrolFontName’) or set(groot,‘defaultuicontrolFontName’).

要访问默认的uicontrol字体,使用get(root,‘defaultuicontrolFontName’)或set(root,‘defaultuicontrolFontName’)。

MATLAB measures all units from the lower left corner of the parent object.

This property affects the Position property. If you change the Units property, consider returning its value to the default value after completing your computation to avoid affecting other functions that assume the default value.

The order in which you specify the Units and Position properties has these effects:

If you specify the Units before the Position property, then MATLAB sets Position using the units you specify.

If you specify the Units property after the Position property, MATLAB sets the position using the default Units. Then, MATLAB converts the Position value to the equivalent value in the units you specify.

MATLAB从父对象的左下角开始测量所有单位。

此属性影响Position属性。如果您更改了Units属性,请考虑在完成计算后将其值返回为默认值,以避免影响使用默认值的其他函数。

指定单位和位置属性的顺序有以下效果:

如果您在位置属性之前指定单位,那么MATLAB将使用您指定的单位设置位置。

如果在Position属性之后指定Units属性,MATLAB将使用默认的Units设置位置。然后,MATLAB将Position值转换为您指定的单位的等效值。

color 属性

Background color, specified as an RGB triplet, a hexadecimal color code, a color name, or a short name. If you specify ‘none’, the background color appears black on screen, but if you print the figure, the background prints as though the figure window is transparent.

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].
  • A hexadecimal color code is a character vector or a string scalar
    that starts with a hash symbol (#) followed by three or six
    hexadecimal digits, which can range from 0 to F. The values are not
    case sensitive. Therefore, the color codes “#FF8800”,
    “#ff8800”,“#F80”, and “#f80” are equivalent.

Alternatively, you can specify some common colors by name. This table lists the named color options, the equivalent RGB triplets, and hexadecimal color codes.

在这里插入图片描述
Here are the RGB triplets and hexadecimal color codes for the default colors MATLAB uses in many types of plots.

在这里插入图片描述
如图:

在这里插入图片描述

3.f = figure(___)

f is this figure object.

一个 figure 的所有 property,即所有属性:

在这里插入图片描述

在这里插入图片描述

使用 f 修改图片的属性来修改图片, 前提是图片存在, 要是把图片删除了则修改属性的语句会报错.

在这里插入图片描述

4.Working with Multiple Figures Simultaneously

有多个 Figure 同时存在时, 位于最前面的那个 Figure 就是当前活动的 Figure, 画出的图线会画在 Figure 上. 如图:

在这里插入图片描述

5.figure(f) 和 figure(n)

使用此命令可以选中某个 Figure 作为当前活跃窗口. 如图:

在这里插入图片描述

input argument f is target figure object.

input argument n is target figure number.

Target figure number, specified as a scalar integer value. When you specify this argument, MATLAB searches for an existing figure in which the Number property is equal to n. If no figure exists with that property value, MATLAB creates a new figure and sets its Number property to n. By default, the Number property value is displayed in the title of the figure.
(目标图形编号,指定为标量整数值。当指定此参数时,MATLAB将搜索Number属性等于n的现有图形。如果不存在具有该属性值的图形,MATLAB将创建一个新图形,并将其Number属性设置为n。默认情况下,Number属性值显示在图的标题中。)

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.hqwc.cn/news/99922.html

如若内容造成侵权/违法违规/事实不符,请联系编程知识网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

yocto stm32mp1集成ros

yocto stm32mp1集成ros yocto集成ros下载meta-rosyocto集成rosrootfs验证 yocto集成ros 本章节介绍yocto如何集成ros系统用来作机器人开发。 下载meta-ros 第一步首先需要下载meta-ros layer,meta-ros的链接如下:https://github.com/ros/meta-ros/tre…

python in excel 如何尝鲜 有手就行

众所周知,微软在8月下旬放出消息python已入驻excel,可到底怎么实现呢。 今天我就将发布python in excel的保姆级教程,开始吧! 获取office 365 账号 首先我们要有微软office365 这时候需要再万能的某宝去找一个账号,…

图论-01-图的基本表示-邻接矩阵和邻接表-Java

文章目录 邻接矩阵邻接表邻接表的问题和改进总结 邻接矩阵 import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.Scanner;public class AdjMatrix {private int V;private int E;private int[][] adj;// 构造函数,从文…

Java 大文件排序

大文件排序 http://en.wikipedia.org/wiki/Merge_sort http://en.wikipedia.org/wiki/External_sorting 外排序 通常来说,外排序处理的数据不能一次装入内存,只能放在读写较慢的外存储器(通常是硬盘)上。 外排序通常采用的是…

Vue + Element UI 前端篇(一):搭建开发环境

Vue Element UI 实现权限管理系统 前端篇(一):搭建开发环境 技术基础 开发之前,请先熟悉下面的4个文档 vue.js2.0中文, 优秀的JS框架vue-router, vue.js 配套路由vuex,vue.js 应用状态管理库Element,饿…

2023年09月IDE流行度最新排名

点击查看最新IDE流行度最新排名(每月更新) 2023年09月IDE流行度最新排名 顶级IDE排名是通过分析在谷歌上搜索IDE下载页面的频率而创建的 一个IDE被搜索的次数越多,这个IDE就被认为越受欢迎。原始数据来自谷歌Trends 如果您相信集体智慧&am…

AI:07-基于卷积神经网络的海洋生物的识别

当涉及海洋生物的识别和研究时,基于深度学习的方法已经展现出了巨大的潜力。深度学习模型可以利用大量的图像和标记数据来自动学习特征,并实现高准确度的分类任务。本文将介绍如何使用深度学习技术来实现海洋生物的自动识别,并提供相应的代码示例。 数据收集和预处理 要训…

python调用C语言库

1. 在linux下通过gcc生成so库 //请保存为 foo.c #include<stdio.h> #define uint8_t unsigned char #define uint16_t unsigned shorttypedef struct TagMyStruct {char name[10];uint8_t age;int score; } MyStruct,*MyStructPointer;MyStructPointer foo_get_data_…

一文讲清楚redis的线程池jedis

背景 在shigen实习的时候&#xff0c;遇到了日志系统的性能优化问题&#xff0c;当时的优化点就是&#xff1a;使用redis的线程池&#xff0c;实现并发状态下的性能优化。但是找了很多的技术方案&#xff0c;发现redis的线程池配置起来比较麻烦。正巧&#xff0c;这个周末shig…

【漏洞复现】广联达办公OAsql+文件上传+弱口令

漏洞描述 广联达办公OA是一款综合办公自动化解决方案,旨在提高组织内部的工作效率和协作能力。它提供了一系列功能和工具,帮助企业管理和处理日常办公任务、流程和文档。默认弱口令admin password,后面就不提了。 免责声明 技术文章仅供参考,任何个人和组织使用网络应当…

Redis快速入门

文章目录 0. Redis介绍1. Centos下Redis安装2. redis.conf配置文件介绍3. redis相关命令4.redis中发布订阅和事务4.1 发布订阅&#xff08;Pub/Sub&#xff09;4.2 事务 5. redis封装系统服务6. 问题与解决6.1 启动Redis报错&#xff1a;Could not create Server TCP listening…

STM32微控制器的低功耗模式

STM32微控制器的低功耗模式(Low-power modes):Sleep mode、Stop mode 和 Standby mode。 1.1 Sleep Mode(睡眠模式): 把STM32微控制器当作一位劳累的工人,他在工作过程中需要短暂的休息。在Sleep模式下,微控制器会关闭一部分电路,减小功耗,但仍然保持对中央处理单…