Matla学习:figure+axes+plot
function fig = SetDrawParam()
%.获得屏幕尺寸
figpos = , 'ScreenSize');%获得屏幕尺寸,单位像素
%.设置坐标系在画布中的位置,针对不同尺寸或不同分辨的屏幕需要动态调整才能达到预期的效果
axex = ;%坐标系原点在画布中的横坐标,单位像素
axey = ;%坐标系原点在画布中的纵坐标,单位像素
axew = ;%坐标系的宽度,单位像素
axeh = ;%坐标系的高度,单位像素
%.设置纸张在画布中的位置,需要坐标系位置确定的情况才能确定纸张的位置,也需要动态调整才能达到预期的效果
paperx = ;%纸张原点在画布中的横坐标,单位厘米
papery = ;%纸张原点在画布中的纵坐标,单位厘米
paperw = ;%纸张的宽度,单位厘米
paperh = ;%纸张的高度,单位厘米
%.设置运行过程中是否显示图像
visible = 'off';
%.建立画布和坐标系
fig = figure('Position', figpos, 'PaperPosition', [paperx, papery, paperw, paperh], 'Visible', visible);
axe = axes('Units', 'Pixel', 'Position', [axex, axey, axew, axeh]);
end
function SetDrawPlot(x, y, style, width, color, marker) plot(x, y, 'LineStyle', style, 'LineWidth', width, 'Color', color, 'Marker', marker, 'MarkerEdgeColor', color); end
function Main_SetDrawPlot_Example()
clear;clc;
folder = '.';
files = dir(strcat(folder, '/*.txt'));
len = length(files);
for i = 1:len
%1.获得文件名
indexs = strfind(files(i).name, '.');
lastIndex = indexs(end);
name = files(i).name(1:lastIndex-1);
%2.确定输入输出
inpath = strcat(folder, '/', files(i).name);
outpath = strcat(folder, '/', name, '.png');
%3.提取数据并确定范围
txt = importdata(inpath);
x = 1:1:length(txt.data);
%4.绘图并保存
fig = SetDrawParam();
y = txt.data(:,1);
SetDrawPlot(x, y, '-', 0.5, [0, 0, 1], 'none');
hold on;
y = txt.data(:,2);
SetDrawPlot(x, y, '-', 0.5, [0, 1, 0], 'none');
hold on;
y = txt.data(:,3);
SetDrawPlot(x, y, '-', 0.5, [1, 0, 0], 'none');
saveas(fig, outpath);
close all;
end
end
Matla学习:figure+axes+plot的更多相关文章
- 《MATLAB从入门到放弃》二维曲线和图形绘制基础(二):使用Help文档学习line、plot、plotyy、subplot、hold绘图函数
目录: » plot 最常用的二维曲线绘图函数 > 帮助文档 > 基本使用语法 > 线条的样式.符号和颜色调整 > 图形属性调整 > 使用图形句柄进行设置 » ...
- 一张图理解"Figure", "Axes", "Axis"
Figure is the object with the highest level in the hierarchy. It corresponds to the entire graphical ...
- 4.8Python数据处理篇之Matplotlib系列(八)---Figure的学习
目录 目录 前言 (一)figure()方法的定义 (二)figure()方法的参数 (三)figure()方法的例子 1.多窗体绘图: 2.窗口得分别率 目录 前言 今天我们来学习一下plt.fig ...
- Python:2D画图库matplotlib学习总结
本文为学习笔记----总结!大部分为demo.一部分为学习中遇到的问题总结.包含怎么设置标签为中文等.matlab博大精深.须要用的时候再继续吧. Pyplot tutorial Demo地址为:点击 ...
- 数据挖掘---Matplotib的学习
什么是matplotlib mat - matrix 矩阵 二维数据 - 二维图表 plot - 画图 lib - libra ...
- 图形对象函数figure() 及 子图创建函数subplot()
1 图像对象创建函数figure 创建图形Creates a new figure, 图形名既可以作为显示在图形窗口标题栏中的文本,也是该对象的名称 也可以通过mp.figure()获取(或激活)已创 ...
- matplotlib学习笔记.CookBook
matplotlib 是Python下的一个高质量的画图库,可以简单的类似于MATLAB方法构建高质量的图表. 原始文章地址:http://zanyongli.i.sohu.com/blog/view ...
- 20190906_matplotlib_学习与快速实现
20190906 Matplotlib 学习总结 第一部分: 参考连接: Introduction to Matplotlib and basic line https://www.jianshu.c ...
- matlab学习笔记9 高级绘图命令_1 图形对象_根对象,轴对象,用户控制对象,用户菜单对象
一起来学matlab-matlab学习笔记9 高级绘图命令_1 图形对象_根对象,轴对象,用户控制对象,用户菜单对象 觉得有用的话,欢迎一起讨论相互学习~Follow Me 参考书籍 <matl ...
随机推荐
- 使用 jQuery UI Widget Factory 编写有状态的插件(Stateful Plugins)
使用 jQuery UI Widget Factory 编写有状态的插件(Stateful Plugins) Note 这一章节的内容是基于 Scott Gonzalez 一篇博客 Building ...
- .net托管平台appharbor使用
这篇文章是网上转过来的,在AppHarbor使用Git上传Code的时候,需要输入用户名和密码,就是appharbor登陆的用户名和密码. 可以参考这篇文章http://www.freehao123. ...
- VBA 打开一个string指定的文件
Open csvFileName For Input As #1 Dim lineChanger as String lineChanger = Chr(13) fileData = Split(St ...
- VS2012远程调试(winform+web 远程调试)
VS2012远程调试 一.调试WinFrom 程序 安装rtools_setup_x64 下载 配置Remote 启动Remote debugger 默认端口4016,选择工具-〉选项,选择 无身 ...
- 【转】libvirt kvm 虚拟机上网 – Bridge桥接
libvirt kvm 虚拟机上网 – Bridge桥接 2013 年 7 月 3 日 / 东东东 / 暂无评论 目录 [hide] 1 Bridge桥接原理 2 在host机器配置桥接网络 2.1 ...
- 【Redis】配置redis主从复制
阅读目录 redis-3.2.1.master tar zxvf redis-3.2.1.tar.gz mv redis-3.2.1 redis-3.2.1.slave-1 tar zxvf redi ...
- jquery form表单序列号
1.serialize()方法 格式:var data = $("form").serialize(); 功能:将表单内容序列化成一个字符串. 这样在ajax提交表单数据时,就不用 ...
- HDU2490 parade
题目大意:一个n+1行m+1列的表格,每个格子两个数w和c,表示经过该格子的happy和体力消耗值tireness.现在从最下面任意处开始,可以向左向右向上走.但不能向下.每个格子不能经过两次.在每一 ...
- 关于 xcode 工程编译报错 undefined symbol _res_9_init的解决办法
将libresolv.dylib 添加到工程引用中(通过build phases中).补充: _res_9_init定义在resolv.h中,可以参考http://www.opensource. ...
- Servlet间的跳转
Forward 转向(Forward)是通过RequestDispatcher对象的forward(HTTPServletRequest req, HttpSerletRespon ...