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 !

相关推荐
测试老哥3 分钟前
Postman获取token并设置token依赖步骤
自动化测试·软件测试·python·测试工具·测试用例·接口测试·postman
郝学胜-神的一滴6 分钟前
C++11 工程级应用 06:自己造一个类似Python的Range迭代器
开发语言·c++·windows·python·程序人生·microsoft
满怀冰雪8 分钟前
23-PaddleClas 数据集、配置文件与训练参数详解
人工智能·python·深度学习·paddlepaddle
笔触狂放1 小时前
第3章 抓取静态网页数据
爬虫·python
海兰1 小时前
【 Python 量化交易】开篇
开发语言·python·信息可视化·量化交易
pt10431 小时前
网络自动化Python课程:Netconf与Restconf及Cisco自动化配置实验
网络·python·自动化
slacker-kian1 小时前
[笔记]-什么是相似性搜索?
python·ai·向量·相似性搜索·点积·l2 距离·余弦相似度和距离
阿童木写作1 小时前
跨境电商图片翻译工具,批量翻译视频字幕还免费
python·音视频
sukioe1 小时前
城智连响:基于 LangGraph 与四库分层架构的城市公共设施智能报修与派单系统
人工智能·python·ai·架构·langchain
卷无止境2 小时前
Coding Agent 里的上下文 Compact,到底在压缩什么
后端·python