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 !

相关推荐
小二·2 分钟前
Python Web 开发进阶实战:国际化(i18n)与多语言支持 —— Vue I18n + Flask-Babel 全栈解决方案
前端·vue.js·python
小二·8 分钟前
Python Web 开发进阶实战:API 安全与 JWT 认证 —— 构建企业级 RESTful 接口
前端·python·安全
Allen_LVyingbo11 分钟前
具备安全护栏与版本化证据溯源的python可审计急诊分诊平台复现
开发语言·python·安全·搜索引擎·知识图谱·健康医疗
weixin1997010801612 分钟前
安家 GO item_get - 获取安家详情数据接口对接全攻略:从入门到精通
java·大数据·python·golang
Wzx19801215 分钟前
自研开发的前后端项目部署流程
vue.js·python
洛豳枭薰21 分钟前
Java常用开发工具
java·开发语言·python
西红市杰出青年24 分钟前
crawl4ai------AsyncPlaywrightCrawlerStrategy使用教程
开发语言·python·架构·正则表达式·pandas
写代码的【黑咖啡】27 分钟前
Python 中的 sqlite3 模块:轻量级数据库的完美搭档
数据库·python·sqlite
半路_出家ren27 分钟前
20.基于Selenium实现界面自动化控制
运维·python·selenium·测试工具·网络安全·自动化·chromedriver
计算机毕业设计指导27 分钟前
恶意网址检测系统
python·web安全·网络安全·系统安全