Comments (8)
But by default, palette=rainbow
. See
Line 150 in 3dec2ce
from ouch.
Yes, I saw that. Sorry. I guess we want default palette = NULL, and if (is.null(palette)) palette=rainbow( length(levs)) ?
from ouch.
Or is
if (palette==rainbow) palette <- rainbow(length(levs))
a valid check? Otherwise use the vector specified ?
from ouch.
So I tried changing the default palette = rainbow in an tree plot, and it had no effect. I thought that rainbow(length(levs)) would return a vector of hex color codes, so I tried writing a dummy function 'mypal' that would return the same type of object:
col2hex <- function(cc) {rgb(col2rgb(cc)[1], col2rgb(cc)[2], col2rgb(cc)[3], maxColorValue=255)}
mypal <- function(x){return(c(col2hex("black"), col2hex("blue"), col2hex("purple")))}
data(bimac)
tree <- with(bimac,ouchtree(node,ancestor,time/max(time),species))
plot(tree,regimes=bimac["OU.LP"], palette=mypal) # no effect
plot(tree,regimes=bimac["OU.LP"], palette= c("black", "blue", "purple")) # no effect
I don't understand why specifying palette does nothing. It is a parameter to the plot function. Is it masked some how?
from ouch.
Are you running the plotting branch? It works for me. Will merge the plotting branch in when we are finished with it.
from ouch.
I've merged these changes to the master branch. Please have a look.
from ouch.
Thank you! It does work. Sorry for the delay.
Had figured out how to install from branch yesterday, lol. But I didnʻt have time to reply. It works but itʻs kind of awkward:
plot(tree, regimes=bimac["OU.LP"], palette=function(x)return(c("blue", "turquoise", "pink")))
Was the simplest implementation I could find. How about if we could also supply a vector? in tree.plot.internal:
ifelse (class(palette)=="function", palette(length(levs)), palette)
Then a vector could be supplied.
from ouch.
Will do.
from ouch.
Related Issues (7)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ouch.