@@ -418,6 +418,7 @@ def __init__(
418418 ylabel_template : str = '{name}:{strand}' ,
419419 ylabel_horizontal : bool = True ,
420420 shared_y_scale : bool = False ,
421+ global_ylims : tuple [float , float ] | None = None ,
421422 alpha : float = 0.8 ,
422423 order_tdata_by_mean : bool = True ,
423424 max_num_tracks : int = 50 ,
@@ -433,7 +434,9 @@ def __init__(
433434 track_height: The height of each track.
434435 ylabel_template: A template for the y-axis labels.
435436 ylabel_horizontal: Whether to make the y-axis labels horizontal.
436- shared_y_scale: Whether to use the same y-axis scale for all tracks.
437+ shared_y_scale: Whether to use the same y-axis scale for all tracks. This
438+ is inferred from the min/max data values across all tracks.
439+ global_ylims: Optional global y-axis limits (min and max).
437440 alpha: The transparency of the tracks.
438441 order_tdata_by_mean: Whether to order the tracks by their mean value (in
439442 descending order).
@@ -457,6 +460,7 @@ def __init__(
457460 self ._ylabel_template = ylabel_template
458461 self ._ylabel_horizontal = ylabel_horizontal
459462 self ._shared_y_scale = shared_y_scale
463+ self ._global_ylims = global_ylims
460464 self ._alpha = alpha
461465 self ._order_tdata_by_mean = order_tdata_by_mean
462466 self ._kwargs = kwargs
@@ -571,7 +575,9 @@ def _make_ordered_dict_by_mean(tdata):
571575 )
572576 arr = tdata .values [:, axis_index ]
573577
574- if self ._shared_y_scale :
578+ if self ._global_ylims is not None :
579+ ax .set_ylim (self ._global_ylims )
580+ elif self ._shared_y_scale :
575581 ax .set_ylim (self ._vmin , self ._vmax )
576582
577583 # Plot the two tracks on the same axis. We plot the larger values first so
0 commit comments