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 !

相关推荐
钅日 勿 XiName1 分钟前
一小时速通Pytorch之自动梯度(Autograd)和计算图(Computational Graph)(二)
人工智能·pytorch·python
故林丶9 分钟前
【Django】Django笔记
python·django
IT北辰36 分钟前
Python实现居民供暖中暖气能耗数据可视化分析(文中含源码)
开发语言·python·信息可视化
FreeCode36 分钟前
LangChain1.0智能体开发:长期记忆
python·langchain·agent
Predestination王瀞潞1 小时前
Python __name__ 与 __main__
开发语言·python
萧曵 丶1 小时前
Python 字符串、列表、元组、字典、集合常用函数
开发语言·前端·python
梦想的初衷~2 小时前
Plaxis自动化建模与Python应用全解:从环境搭建到高级案例实战
python·自动化·工程设计·工程软件
Q_Q5110082852 小时前
python+uniapp基于微信小程序的垃圾分类信息系统
spring boot·python·微信小程序·django·flask·uni-app·node.js
HackerTom2 小时前
vs code jupyter连gpu结点kernel
python·jupyter·gpu·vs code·远程
yong99902 小时前
MATLAB实现DLT645协议
开发语言·matlab