Matlab交互式的局部放大图

在数据可视化中,很多时候需要对某一区间的数据进行局部放大,以获得对比度更高的可视化效果。下面利用 MATLAB 语言实现一个交互式的局部放大图绘制。
源码自行下载:

链接:https://pan.baidu.com/s/1yItVSinh6vU4ImlbZW6Deg?pwd=9dyl 提取码:9dyl

使用方法

1.将 BaseZoom.m 和 parameters.json 添加到 MATLAB 的搜索路径或者绘图代码所在的工作目录;

2.完成基本绘图之后,在命令行窗口或者绘图代码后面输入以下两行代码:

matlab 复制代码
zp = BaseZoom();  % 添加 1 个放大区域
zp.plot;

如果要绘制多个放大区域,比如3个,则输入以下代码:

matlab 复制代码
% 添加 3 个放大区域
zp = BaseZoom();
zp.plot;
zp.plot;
zp.plot;


绘图配置参数的自定义

ZoomPlot 的绘图配置参数存储在 parameters.json 中,默认值为:

matlab 复制代码
{
    "subAxes": 
        {
            "Color": "none",
            "LineWidth": 1.2,
            "XGrid": "off",
            "YGrid": "off",
            "ZGrid": "off",
            "GridAlpha": 0.15,
            "GridColor": [0.15, 0.15, 0.15],
            "GridLineStyle": "-",
            "Box": "on",
            "TickDir": "in",
            "Comments": "theme of the sub axes"
        },

    "zoomedArea": 
        {
            "Color": "k",
            "FaceColor": "none",
            "FaceAlpha": 0,
            "LineStyle": "-",
            "LineWidth": 1.5,
            "Comments": "theme of the zoomed area"
        },

     "dynamicRect": 
        {
            "LineColor": [0, 0.4471, 0.7412],
            "LineWidth": 2,
            "Marker": "s",
            "MarkerSize": 9,
            "FaceColor": [0, 0.4471, 0.7412],
            "FaceAspect": 0.3,
            "EdgeColor": "k",
            "Comments": "theme of the zoomed area"
        },

     "connection": 
        {
            "LineColor": "k",
            "LineWidth": 1.5,
            "LineStyle": ":",
            "StartHeadStyle": "ellipse",
            "StartHeadLength": 3,
            "StartHeadWidth": 3,
            "EndHeadStyle": "cback2",
            "EndHeadLength": 7,
            "EndHeadWidth": 7,
            "Comments": "theme of the zoomed area"
        }

}

可以看到,一共有四个部分的配置参数:

1.subAxes(子坐标系)

2.zoomedArea(放大区域)

3.dynamicRect(调整过程中的动态矩形)

4.connection(子坐标系和放大区域的连接线)

资料来源于知乎大佬@iqiukp !

相关推荐
m0_4954964135 分钟前
mysql处理复杂SQL性能_InnoDB优化器与MyISAM差异
jvm·数据库·python
forEverPlume1 小时前
PHP怎么使用Eloquent Attribute Composition属性组合_Laravel通过组合构建复杂属性【方法】
jvm·数据库·python
Aleeeeex1 小时前
RAG 那点事:从 8 份企业文档到能用的问答系统,全过程拆给你看
人工智能·python·ai编程
2301_809204702 小时前
mysql在docker容器中如何部署_利用docker-compose快速启动
jvm·数据库·python
2301_800976933 小时前
正则表达式
开发语言·python·正则表达式
码界奇点3 小时前
基于Python的新浪微博数据爬虫系统设计与实现
数据库·爬虫·python·毕业设计·新浪微博·源代码管理
AI木马人3 小时前
1.人工智能实战:大模型推理接口响应慢?从模型加载到 FastAPI 部署的完整优化方案
人工智能·python·fastapi
青少儿编程课堂3 小时前
2026青少儿信息素养大赛备赛指南!Python/Scratch/C++备考要点
开发语言·c++·python
用户8356290780514 小时前
使用 Python 设置 Excel 数据验证
后端·python
Nick_zcy4 小时前
小说在线阅读网站和小说管理系统 · 功能全解析
java·后端·python·springboot·ruoyi