Skip to content

Change bar to area plot#13

Open
jwertz01 wants to merge 2 commits intologsdon-lab:mainfrom
jwertz01:main
Open

Change bar to area plot#13
jwertz01 wants to merge 2 commits intologsdon-lab:mainfrom
jwertz01:main

Conversation

@jwertz01
Copy link

No description provided.

@koisland
Copy link
Collaborator

Hi @jwertz01,

Thanks for the PR but I'd like to preserve the bar plot functionality as it's a less lossy representation of the input data. I'd be more willing to accept this change if you added a separate parameter like use_area or start_only to BarSettings.

class BarTrackSettings(DefaultTrackSettings):

class BarTrackSettings(DefaultTrackSettings): 
    # ...
    start_only: bool = False
    """
    Plot start position only. A smoother representation of data.
    NOTE: This will result in the last interval's end position being ignored.
    """

Then, add a branch here to switch.

ax.bar(
track.data["chrom_st"],
track.data["name"],
track.data["chrom_end"] - track.data["chrom_st"],
label=label,
**plot_options,
)

if track.options.start_only:
     ax.fill_between( 
         track.data["chrom_st"], 
         track.data["name"], 
         0, 
         label=label, 
         **plot_options, 
     ) 
else:
     ax.bar( 
         track.data["chrom_st"], 
         track.data["name"], 
         track.data["chrom_end"] - track.data["chrom_st"], 
         label=label, 
         **plot_options, 
     ) 

@koisland koisland mentioned this pull request Jun 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants