Skip to content
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

Suggestions for plotting options #3

Closed
mbutler808 opened this issue Mar 19, 2021 · 3 comments
Closed

Suggestions for plotting options #3

mbutler808 opened this issue Mar 19, 2021 · 3 comments
Assignees

Comments

@mbutler808
Copy link

Some suggestions for plotting options that are better for large phylogenies or long taxon labels. We had a problem with not being able to read the metadata because it was cut off

https://github.com/kingaa/ouch/blob/master/R/plot.R#L17
Add frame.plot, cex, offset, rtspace arguments for tree.plot.internal:

# most users will not want the frame around the plot, but specifying it as part of ... generates a warning because itʻs not a valid argument to text() 
# the offset and rtspace is set to allow more space for taxon names (and at least show users what to change if need be)
# also changed the figure size to accommodate long taxon names
tree.plot.internal <- function (x, regimes = NULL, labels = x@nodelabels, legend = TRUE, frame.plot=F, cex=1, offset=0.1, rtspace=1, ...) {

More room for figure and Check size allotted to labels by character length:

    par(yaxt='n', mar=c(4, 1, 1, 1))
    plot(X,Y,type='l',col=C,xlab='time',ylab='',xlim=rx+c(-rxd,rtspace*rxd+max(strwidth(labels, units="figure"))),ylim=c(0,1), frame.plot=frame.plot,...)

And did you mean to include ... for text or only for plot? But if it is not a valid option it will throw a warning. The cex and offset are used here.

     text(X[seq(1,length(X),6)],Y[seq(1,length(Y),6)],labels[f],pos=4, cex=cex, offset=offset)

Also it would be really nice to be able to specify the pallette as an argument, but I am mulling over the best way to associate it with regime. - attach a regime name to the value?

These are small things, but really annoying when youʻre trying to get the figure right for publication.
Thank you!
Marguerite

plot.R.txt

@kingaa kingaa self-assigned this Mar 20, 2021
@kingaa
Copy link
Owner

kingaa commented Mar 20, 2021

@mbutler808: some of these things are easily accommodated. Others require substantial thinking. On the whole, I'm wary of including all the options present in lower-level functions, because this becomes a headache to maintain. I agree that it is unfortunate that the ... is passed both to text and to plot. This is clearly a problem. I suppose one way to deal with it is to have ... passed, e.g., to plot and another option, say text_opts passed to text. There is also legend....

More generally, preparation of publication-quality figures need not be a goal of ouch, especially in the presence of other packages that have this as a goal. For example, I am very fond of ggtree, but I suppose there are others. The goal of ouch should be to support analysis using the models it provides. This does include a certain amount of graphics, so that users can e.g., load data and verify that it is entered correctly, paint a tree and check that it is done properly, visualize alternative hypotheses, etc. However, preparation of publication-quality graphics is something better left to other packages.

@kingaa
Copy link
Owner

kingaa commented Mar 20, 2021

Just pushed a new branch. Please have a look. Access to the options of the low-level functions plot, text, and legend is now possible. Ladderization is an option, with the default being to ladderize. The color palette is customizable.

@mbutler808
Copy link
Author

Thank you so much Aaron. Really appreciate you working on this. I checked it out and marked a couple of things in new issues. I understand the pain in terms of maintenance, the publication-quality remark was just a bonus. Seems to me that this is very close to publication quality, and a lot of people would just go with this.

But the more important issue is plotting the trees and regimes for checking your data analysis. I should have indicated which was the biggest problem -- cutting off names. It has hindered us because we have a lot of unnamed species and long meta data. We used just short codes for a while, but finally had to check and there were errors that we missed because we couldnʻt see the names and/or sites. Itʻs an easy fix, I think, just need to calculate the space based on character length which I provided. This is really important for the analysis set-up and checking. Once everything is correct, of course we would make shorter names for publication.

Also one other comment - ouchʻs plotting routines are SO MUCH FASTER than ape or phylotools. Itʻs noticeable. So much more pleasant to do data exploration. My student is doing a biogeographic analysis on this huge phylogeny and needs to paint it in many different ways.

I have avoided ggplot and therefore ggtree, because ggplot is poorly documented and the syntax is so different. It was too frustrating to learn. But I may have to eventually.

Thanks,
Marguerite

@kingaa kingaa closed this as completed Mar 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants