ggbunch#
- ggbunch(plots: List, regions: List[Tuple[float, float, float, float, float, float]]) SupPlotsSpec #
Combine several plots into a single figure with custom layout.
- Parameters:
- plotsList
A list where each element is one of:
a plot specification
a subplots specification
None
- regionsList[Tuple]
Layout parameters for each plot. Each region is specified as (x, y, width, height, dx, dy) where:
x, y: Position of the plot’s top-left corner in relative coordinates ([0,0] is top-left corner, [1,1] is bottom-right corner of the container).
width, height: Size of the plot relative to container dimensions (1 equal to the full container width/height).
dx, dy: Pixel offsets to move the region (defaults to 0).
- Returns:
- SupPlotsSpec
A specification describing the combined figure with all plots and their layout.
Examples
1import numpy as np 2from lets_plot import * 3LetsPlot.setup_html() 4np.random.seed(42) 5data = {'x': np.random.gamma(2.0, size=100)} 6p1 = ggplot(data, aes(x='x')) + \ 7 geom_histogram(aes(color='x', fill='x')) 8p2 = ggplot(data, aes(x='x')) + \ 9 geom_density() + theme_bw() + theme(axis='blank', panel_grid='blank') 10ggbunch( 11 [p1, p2], 12 [(0, 0, 1, 1), 13 (0.5, 0.1, 0.3, 0.3)] 14) + ggsize(400, 300)