Skip to content

YesselmanLab/rna_map_plotting

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

yplot

A Python library for flexible subplot layout customization with per-row and per-column sizing, spacing, and margins.

Features

  • Unified SubplotLayout system with class, dictionary, and YAML configuration support
  • Flexible subplot layouts with exact size control
  • Per-row and per-column customization for different subplot sizes
  • Variable spacing between rows and columns
  • YAML file support for easy configuration management
  • Backward compatibility with uniform layouts
  • Mixed specifications combining uniform and per-row settings

Install

To install yplot:

python -m pip install git+https://github.com/jyesselm/yplot

Quick Start

New SubplotLayout System (Recommended)

from yplot.figure import SubplotLayout
from yplot.plotting import create_figure_with_layout

# Create layout object
layout = SubplotLayout(fig_size_inches=(10, 8), rows=2, cols=3)
layout.row_heights = [3.0, 2.0]
layout.col_widths = [2.5, 2.5, 2.5]
layout.set_uniform_wspace(0.5)
layout.set_uniform_hspace(0.3)

# Create figure
fig, axes = create_figure_with_layout(layout)

YAML Configuration

# layout.yaml
fig_size: [10, 8]
rows: 2
cols: 3
row_heights: [3.0, 2.0]
col_widths: [2.5, 2.5, 2.5]
wspace: [0.5]
hspace: [0.3, 0.3]
margins:
  left: 0.75
  right: 0.75
  top: 0.75
  bottom: 0.75
# Load from YAML
fig, axes = create_figure_with_layout('layout.yaml')

Legacy Interface (Still Supported)

from yplot.figure import calculate_subplot_coordinates

# Uniform layout (backward compatible)
coords = calculate_subplot_coordinates(
    fig_size_inches=(7, 5),
    subplot_layout=(2, 3),
    subplot_size_inches=(1.8, 1.8),
    spacing={'hspace': 0.3, 'wspace': 0.3, 'margins': {'left': 0.5, 'right': 0.5, 'top': 0.5, 'bottom': 0.5}}
)

Documentation

For comprehensive examples and API reference, see:

TODO

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published