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 regarding value = 0 and 10 #3

Closed
bryanhanson opened this issue Jun 24, 2013 · 1 comment
Closed

Suggestions regarding value = 0 and 10 #3

bryanhanson opened this issue Jun 24, 2013 · 1 comment

Comments

@bryanhanson
Copy link

One thing that might be nice, from an aesthetic and teaching point of view, would be for functions like hue_slice to draw the pure black and pure white at the top and bottom of the plot. I think this would help people who are learning the munsell system. I see that these values are not included in munsell.map and so would have to be appended to the draw list manually.

On a related note, if one happens to ask for munsell colors using a vector of colors which includes value = 0 or value = 10 a warning is issued. Two different kinds of uses that produce different errors resulting from this are:

value_slice(10)

tf <- function(minHue = "5R", maxHue = "5R",
    minVal = 8, maxVal = 10, minChroma = 2, maxChroma = 6) {

    # Process arguments to formated colors
    hueMin <- which(mnsl_hues() == minHue)
    hueMax <- which(mnsl_hues() == maxHue)
    hues <- mnsl_hues()[hueMin:hueMax]
    hvc <- expand.grid(hue = hues, value = minVal:maxVal,
        chroma = seq(minChroma, maxChroma, by = 2))
    m <- paste(hvc$hue, " ", hvc$value, "/", hvc$chroma, sep = "")
    cat("m = \n")
    print(m)

    # Convert colors to hexadecimals for plotting
    gam <- in_gamut(m)
    cat("gam = \n")
    print(gam)
    fix <- fix_mnsl(m)
    cat("fix = \n")
    print(fix)
    mh <- mnsl(m, fix = TRUE)

    }

tf()

The error comes from in_gamut, I think when it looks up values in munsell.map there is a logic check which eliminates value = 10 since it is not in munsell.map and then the lengths are not as expected.
It would be a slightly nicer user experience if this condition was trapped and just a message issues, or it could be silently fixed.

@cwickham
Copy link
Owner

cwickham commented Jul 3, 2013

Good suggestions. The easiest way to solve the first was to include definitions for all hues at all values with chroma = 0. Then without any changes to the plotting code, hue_silce displays the grey scale (including white and black) on the right.

This also fixes the second point you make.

The new definitions are have the usual "N ?/?" names so you can't look up them up. I.e mnsl("5B 10/0") doesn't work. However you can fix them to get the right name (and hex code), i.e.

fix_mnsl("5B 10/0")
[1] "N 10/0"

@cwickham cwickham closed this as completed Jul 3, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants