ggtree icon indicating copy to clipboard operation
ggtree copied to clipboard

Control x-axis ticks on geom_fruit

Open MaximePolicarpo opened this issue 2 years ago • 2 comments
trafficstars

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

MaximePolicarpo avatar Mar 08 '23 07:03 MaximePolicarpo

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.

xiangpin avatar Mar 09 '23 02:03 xiangpin

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

All the best,

Maxime

MaximePolicarpo avatar Mar 09 '23 08:03 MaximePolicarpo