YuLab-SMU / ggtree

:christmas_tree:Visualization and annotation of phylogenetic trees
https://yulab-smu.top/treedata-book/
830 stars 172 forks source link

Control x-axis ticks on geom_fruit #565

Open MaximePolicarpo opened 1 year ago

MaximePolicarpo commented 1 year ago

Hi !

I was wondering if there was a way to control x-axis ticks limits and breaks on geom_fruit ?

For example, on the plot attached, I have a tree with two overlapping barplots added with geom_fruit. I would like the first geom_fruit axis labels to stop at 200 with 5 ticks at 0, 50, 100, 150, 200 (i.e. remove the gray lines at 250 and 300). And for the second grom_fruit, I would like to remove the gray line at 2500 and 3000. Maxime_example_xaxis_ticks.pdf

It seems like we can only control the number of ticks using "nbreak" in the axis.params list.

Thanks for any help or suggestions,

Maxime Policarpo

xiangpin commented 1 year ago

Now, the github version (reinstall it by remotes::install_github("YuLab-SMU/ggtreeExtra")) supports this feature, the limits you want will be done after re-run in default, Or you can add limits=200 or limits=2500 in the list of axis.params.

MaximePolicarpo commented 1 year ago

Thanks a lot, I installed the new github version and it now works perfectly using "limits" !

All the best,

Maxime