How matplotlib/mplfinance works
mplfinance is a Python library for financial-data visualization and visual analysis. A user supplies a Pandas OHLC DataFrame to mpf.plot; the plotting implementation validates and prepares it, builds panels, applies styles and widths, then renders through Matplotlib. The README also documents candlestick/OHLC/line, Renko/P&F, volume, technical overlays, customization, realtime animation, and a legacy API. Internal call edges follow excerpts or SOURCE INDEX references; README-only and unsampled capabilities are labeled conservatively.
Main entry points: plotting.py Plot API · _arg_validators.py Input validation · _styles.py Style configuration · _helpers.py Shared helpers
Components 18
Plot entry
- Plot API
src/mplfinance/plotting.py - Input validation
src/mplfinance/_arg_validators.py - Shared helpers
src/mplfinance/_helpers.py
Plot construction
- Plot calculations
src/mplfinance/_utils.py - Panel layout
src/mplfinance/_panels.py - Plot widths
src/mplfinance/_widths.py - Technical overlays
src/mplfinance/plotting.py - Renko and P&F
src/mplfinance/_utils.py
Appearance
- Style configuration
src/mplfinance/_styles.py - Built-in styles
src/mplfinance/_styledata/__init__.py - Style definitions
src/mplfinance/_styledata - Keyword help
src/mplfinance/_kwarg_help.py
Additional APIs
- Realtime animation
markdown/animation.md - Legacy finance API
src/mplfinance/original_flavor.py
Other components
- Data analyst
- OHLC DataFrame
- Matplotlib
- Financial chart
Connections 24
- Data analyst → OHLC DataFrame: supplies
README.md - Data analyst → Plot API: calls
README.md - OHLC DataFrame → Plot API: provides data
README.md - Plot API → Input validation: validates with
src/mplfinance/plotting.py - Plot API → Plot calculations: uses calculations
src/mplfinance/plotting.py - Plot API → Panel layout: builds panels
src/mplfinance/plotting.py - Plot API → Plot widths: sets widths
src/mplfinance/plotting.py - Plot API → Style configuration: uses styles
src/mplfinance/plotting.py - Plot API → Shared helpers: uses helpers
src/mplfinance/plotting.py - Input validation → Shared helpers: uses helpers
src/mplfinance/_arg_validators.py - Panel layout → Shared helpers: uses helpers
src/mplfinance/_panels.py - Panel layout → Input validation: validates panels
src/mplfinance/_panels.py - Plot widths → Input validation: validates options
src/mplfinance/_widths.py - Style configuration → Input validation: validates options
src/mplfinance/_styles.py - Style configuration → Built-in styles: loads styles
src/mplfinance/_styles.py - Style configuration → Shared helpers: uses helpers
src/mplfinance/_styles.py - Built-in styles → Style definitions: registers definitions
src/mplfinance/_styledata/__init__.py - Plot API → Matplotlib: renders with
README.md - Matplotlib → Financial chart: renders
README.md - Plot API → Technical overlays: supports overlays
README.md - Plot API → Renko and P&F: supports Renko/P&F
README.md - Plot API → Realtime animation: supports updating
- Data analyst → Legacy finance API: may use
- Plot API → Keyword help: documents options