-
Notifications
You must be signed in to change notification settings - Fork 101
Feature annotation below track #95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Feature annotation below track #95
Conversation
Thank you for this contribution. I agree it would be useful (cf. #47), for example to show features relevant for the negative strand. I'll have to review this in detail as it's a very important package for us, which will take some time, but please keep this PR open. |
Note that if you want all features to appear below the track, the simplest is to use from dna_features_viewer import GraphicFeature, GraphicRecord
features=[
GraphicFeature(start=0, end=20, strand=+1, label="Small feature"),
GraphicFeature(start=20, end=500, strand=+1, color="#ffcccc",
label="Gene 1 with a very long name"),
]
record = GraphicRecord(sequence_length=600, features=features)
ax, _ = record.plot(figure_width=4)
# Put the labels below the tracks
ax.invert_yaxis()
ax.xaxis.set_ticks_position('top') If the goal is to have labels both above and below the track, then we must be careful with |
Thank you for this, yes all features wanted below the track, at least for this issue. I'll add this as an example, perhaps mention in the main readme as well. |
Thanks for the response, the reason why I would want the label to be on the bottom (also the axis, tick labels etc), is that I want to be able to add other features on top (like lollipop plots etc.) I guess I could add lollipop bars by adding a negative to the y axis numbers, but it would be nice to have that flexible option. and more intuitive in adding other features? |
Hmm yes that's a good use case, but in that case the parameter should be something like |
I guess that works too? For my use case, the lollipops were added to the Then I guess in other cases to plot two group of labels, one on top and other on the bottom, we can just do Btw, I would still prefer that the |
Yes to clarify what I meant was |
Added an option to place label below track.