-
Notifications
You must be signed in to change notification settings - Fork 14
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
generate unique colors for categorical color
argument to plotSPC
#9
Comments
This is a limitation of A more flexible method could be to distribute the |
Another solution would be random colours. Some good pointers: https://stackoverflow.com/questions/15282580/how-to-generate-a-number-of-most-distinctive-colors-in-r |
Good idea. I suppose than more than 8-10 classes is not our responsibility as the legend becomes impossible to use. Random colors would be nice so as not to convey some kind of ordering when there is none. Several possible paths:
There is still a problem with the legend: the current implementation doesn't scale well to > 8 classes. |
I think that this issue is now 90% solved:
Try it out. library(aqp)
data(sp3)
depths(sp3) <- id ~ top + bottom
# make some fake categorical data
horizons(sp3)$fake.data <- sample(letters[1:15], size = nrow(sp3), replace=TRUE)
# better margins
par(mar=c(0,0,3,1))
# note that there are enough colors for 15 classes (vs. previous limit of 10)
# note that the legend is split into 2 rows when length(classes) > n.legend argument
plot(sp3, color='fake.data', name='fake.data', cex.names=0.8)
# make enough room in a single legend row
plot(sp3, color='fake.data', name='fake.data', cex.names=0.8, n.legend=15) |
plotSPC
does not generate enough colors in the legend (?) when coloring horizons with categorical data containing more than 8 unique values.The text was updated successfully, but these errors were encountered: