# jiumao2/easyplot architecture

> Architecture diagram of the GitHub repository jiumao2/easyplot, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/jiumao2/easyplot
- Repository: https://github.com/jiumao2/easyplot

## Overview

##### Main Components
- Core EasyPlot Package: At the top level, the “EasyPlot” folder is the main package that users add to their MATLAB path. This acts as the entry point (e.g. EasyPlot.figure, EasyPlot.axes, etc.).
- Submodules/Packages:
– +EasyPlot Package: Contains most of the library’s functions; it is the central module.
– +QuickPlot: Contains quick plot functions (e.g. PSTH, printChessboard, rasterPlot) to offer simplified plotting routines.
– +Utils: Offers utility functions such as inpainting_nans, aligning handles, and others that aid figure management and layout.
– @DefaultValue: A special MATLAB class (or package folder) that likely encapsulates default value behavior for functions.
- Supporting Files:
– Documentation.md, demo.mlx, functionSignatures.json from which auto-completion and usage information can be derived.
– License and Documentation assets.

##### Relationships and Interactions between Components
- The external user (or demo.mlx script) interacts with the EasyPlot package by calling high-level functions (e.g., EasyPlot.figure, EasyPlot.axes, EasyPlot.exportFigure) to create and modify figures.
- Under the hood, these core functions may delegate tasks to submodules:
– The ColorMap module is used when setting colormaps (e.g., EasyPlot.colormap).
– QuickPlot functions provide shortcuts for rendering specific types of plots.
– Utils functions support operations such as aligning axes, handling NaNs, and modifying figure properties.
- The @DefaultValue module is likely used across the library to assign or manage default settings for various functions.
- The functionSignatures.json file supports auto-completion, illustrating an integration point between the package’s functional logic and MATLAB’s interactive usage.

##### Architectural Patterns and Design Principles
- Modular Organization: The project is organized into clear submodules (ColorMap, QuickPlot, Utils) each responsible for a particular set of functionalities.
- Namespace Management: The use of “+” prefixed folders (e.g., +EasyPlot, +ColorMap) indicates MATLAB package naming – helping to keep functions organized and avoid naming collisions.
- Extensibility: With clear separation of core plotting functions from helper modules, it is easy to extend functionality or add new plotting paradigms.

##### Relevant Technologies and Frameworks
- MATLAB (the core language environment).
- MATLAB’s package system (the use of “+” folders) to manage namespaces.
- Auto-completion support is facilitated by the functionSignatures.json file.
- Standard MATLAB functions and graphics system for figure creation and manipulation.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% User/Interface Layer
    subgraph "User/Interface Layer"
        DEMO("User/Interface Demo Script (demo.mlx)"):::user
    end

    %% Core Library Layer
    subgraph "Core Library Layer"
        CORE("EasyPlot Core"):::core
    end

    %% Utility Modules Layer
    subgraph "Utility Modules Layer"
        CM("ColorMap Module"):::module
        QP("QuickPlot Module"):::module
        UT("Utils Module"):::module
        DV("DefaultValue Class"):::module
    end

    %% Documentation & Configuration Layer
    subgraph "Documentation & Configuration"
        FS("functionSignatures.json"):::doc
        DOC("Documentation.md"):::doc
        RMD("README.md"):::doc
    end

    %% Relationships
    DEMO -->|"calls"| CORE
    DEMO -->|"reads"| FS
    CORE -->|"uses"| CM
    CORE -->|"triggers"| QP
    CORE -->|"applies"| UT
    CORE -->|"defaults"| DV
    FS -->|"integrates"| CORE
    DOC -->|"guides"| CORE
    RMD -->|"informs"| CORE

    %% Styles
    classDef user fill:#ffcc00,stroke:#000,stroke-width:2px;
    classDef core fill:#66ccff,stroke:#000,stroke-width:2px;
    classDef module fill:#ccffcc,stroke:#000,stroke-width:2px;
    classDef doc fill:#ffcccc,stroke:#000,stroke-width:2px;

    %% Click Events
    click DEMO "https://github.com/jiumao2/easyplot/blob/master/demo.mlx"
    click CORE "https://github.com/jiumao2/easyplot/tree/master/EasyPlot/+EasyPlot"
    click CM "https://github.com/jiumao2/easyplot/tree/master/EasyPlot/+EasyPlot/+ColorMap"
    click QP "https://github.com/jiumao2/easyplot/tree/master/EasyPlot/+EasyPlot/+QuickPlot"
    click UT "https://github.com/jiumao2/easyplot/tree/master/EasyPlot/+EasyPlot/+Utils"
    click DV "https://github.com/jiumao2/easyplot/tree/master/EasyPlot/+EasyPlot/@DefaultValue"
    click FS "https://github.com/jiumao2/easyplot/blob/master/EasyPlot/functionSignatures.json"
    click DOC "https://github.com/jiumao2/easyplot/blob/master/Documentation.md"
    click RMD "https://github.com/jiumao2/easyplot/blob/master/README.md"
```
