# anntzer/mplcursors architecture

> Architecture diagram of the GitHub repository anntzer/mplcursors, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/anntzer/mplcursors
- Repository: https://github.com/anntzer/mplcursors

## Overview

##### Main Components

a) Core Components:
- Matplotlib Integration Layer
- Cursor Management System
- Event Handling System
- Selection Interface
- Data Access Layer

b) Supporting Components:
- Documentation System
- Testing Framework
- Build/Distribution System

**Top Layer (User Interface):**
- Matplotlib Plot Interface
- Interactive Cursor Elements
- Selection Overlays

**Middle Layer (Core Logic):**
- Cursor Manager
- Event Handler
- Pick Information Processor
- Data Selection Controller

**Bottom Layer (Integration):**
- Matplotlib Backend Interface
- Artist Access Layer

##### Component Relationships

- User interaction → Event Handler
- Event Handler → Cursor Manager
- Cursor Manager → Pick Information Processor
- Pick Information Processor → Artist Access Layer
- Artist Access Layer → Matplotlib Backend

##### Implementation Details

Classes from the source files:
- `_mplcursors.py`: Main cursor implementation
- `_pick_info.py`: Selection handling
- Connection points to Matplotlib's event system

##### Additional Elements

Annotations for:
- Supported Matplotlib versions (≥3.1)
- Key dependencies
- Extension points for custom behaviors
- Configuration options

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph UI["User Interface Layer"]
        MPL["Matplotlib Plot Interface"]
        IC["Interactive Cursor Elements"]
        SO["Selection Overlays"]
    end

    subgraph Core["Core Logic Layer"]
        CM["Cursor Manager"]:::cursor
        EH["Event Handler"]:::cursor
        PIP["Pick Information Processor"]:::selection
        DSC["Data Selection Controller"]:::selection
    end

    subgraph Integration["Integration Layer"]
        MBI["Matplotlib Backend Interface"]
        AAL["Artist Access Layer"]
    end

    subgraph Support["Support Systems"]
        DOC["Documentation System"]:::docs
        TEST["Testing Framework"]:::test
        BUILD["Build System"]:::build
        CONFIG["Configuration Management"]:::config
        EXAMPLES["Implementation Examples"]:::examples
    end

    %% Relationships
    MPL --> EH
    IC --> EH
    SO --> EH
    EH --> CM
    CM --> PIP
    PIP --> AAL
    DSC --> AAL
    AAL --> MBI

    %% Support system connections
    CM --> TEST
    PIP --> TEST
    CM --> DOC
    CONFIG --> CM
    EXAMPLES --> CM

    %% Click events for component mapping
    click CM "https://github.com/anntzer/mplcursors/blob/main/src/mplcursors/_mplcursors.py"
    click EH "https://github.com/anntzer/mplcursors/blob/main/src/mplcursors/_mplcursors.py"
    click PIP "https://github.com/anntzer/mplcursors/blob/main/src/mplcursors/_pick_info.py"
    click DSC "https://github.com/anntzer/mplcursors/blob/main/src/mplcursors/_pick_info.py"
    click DOC "https://github.com/anntzer/mplcursors/tree/main/doc/source"
    click TEST "https://github.com/anntzer/mplcursors/blob/main/tests/test_mplcursors.py"
    click BUILD "https://github.com/anntzer/mplcursors/blob/main/pyproject.toml"
    click CONFIG "https://github.com/anntzer/mplcursors/blob/main/src/mplcursors/__init__.py"
    click EXAMPLES "https://github.com/anntzer/mplcursors/tree/main/examples"

    %% Styling
    classDef ui fill:#a8d1f0
    classDef core fill:#b7e3b5
    classDef integration fill:#f0e3a8
    classDef cursor fill:#90EE90
    classDef selection fill:#FFB6C1
    classDef docs fill:#E6E6FA
    classDef test fill:#F0E68C
    classDef build fill:#DEB887
    classDef config fill:#87CEEB
    classDef examples fill:#98FB98

    class MPL,IC,SO ui
    class CM,EH core
    class PIP,DSC core
    class MBI,AAL integration
```
