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 !

相关推荐
问天_观心1 小时前
大模型微调学习(二)
人工智能·python·深度学习·学习·语言模型·transformer
洋洋不叫杨杨1 小时前
揭秘当下知名的SEO优化渠道,你知道几个?
大数据·python
阿童木写作1 小时前
跨境图片翻译工具推荐:批量处理视频字幕与智能抠图
python·音视频
梦想的颜色1 小时前
OCR 识别原理与 Python 识图全实战:从文字提取到图像内容理解
python·计算机视觉·ocr·图像识别·python 识图
禹凕2 小时前
Dijkstra算法详解与应用
python·算法
别走!万哥爱你2 小时前
Python 中可以用于在已排序的列表中查找特定元素的位置的是什么?
python
weixin_307779133 小时前
一维无粘 Burgers 方程的激波形成问题:MacCormack 格式求解
c++·算法·matlab
wxwx_bscxy3223 小时前
基于Python新冠疫情可视化分析系统的设计与实现
java·数据库·spring boot·python·微信小程序·sqlite
TechWayfarer4 小时前
Cloudflare 9·15新政倒计时:用IP风险画像识别AI爬虫,防止误伤Googlebot
网络·人工智能·爬虫·python·tcp/ip·网络安全
禹凕4 小时前
滑动窗口算法实战指南
python·算法