[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [tor-bugs] #21196 [Metrics/Metrics website]: use colorRampPalette instead of limited colorBrewer



#21196: use colorRampPalette instead of limited colorBrewer
-------------------------------------+------------------------------
 Reporter:  iwakeh                   |          Owner:  metrics-team
     Type:  defect                   |         Status:  new
 Priority:  Medium                   |      Milestone:
Component:  Metrics/Metrics website  |        Version:
 Severity:  Minor                    |     Resolution:
 Keywords:                           |  Actual Points:
Parent ID:                           |         Points:
 Reviewer:                           |        Sponsor:
-------------------------------------+------------------------------
Description changed by iwakeh:

Old description:

> This
> {{{
> plot_versions <- function(start, end, path) {
>    known_versions <- c("Other", "0.1.0", "0.1.1", "0.1.2", "0.2.0",
>          "0.2.1", "0.2.2", "0.2.3", "0.2.4", "0.2.5", "0.2.6", "0.2.7",
>          "0.2.8", "0.2.9")
> -  getPalette = colorRampPalette(brewer.pal(12, "Paired"))
> +  getPalette = colorRampPalette(c("red", "white", "blue", "yellow",
> "green", "orange"))
>    colours <- data.frame(breaks = known_versions,
> -    values = rep(brewer.pal(min(12, length(known_versions)), "Paired"),
> -                 len = length(known_versions)),
> +    values = getPalette(length(known_versions)),
>      stringsAsFactors = FALSE)
>    versions <- s[s$version %in% known_versions, ]
>    visible_versions <- sort(unique(versions$version))
> }}}
>
> Could still be tweaked, but works (see atached png)

New description:

 This refers to Metrics Reloaded blog post comment by karsten, January
 10th, 2017.

 {{{
 plot_versions <- function(start, end, path) {
    known_versions <- c("Other", "0.1.0", "0.1.1", "0.1.2", "0.2.0",
          "0.2.1", "0.2.2", "0.2.3", "0.2.4", "0.2.5", "0.2.6", "0.2.7",
          "0.2.8", "0.2.9")
 -  getPalette = colorRampPalette(brewer.pal(12, "Paired"))
 +  getPalette = colorRampPalette(c("red", "white", "blue", "yellow",
 "green", "orange"))
    colours <- data.frame(breaks = known_versions,
 -    values = rep(brewer.pal(min(12, length(known_versions)), "Paired"),
 -                 len = length(known_versions)),
 +    values = getPalette(length(known_versions)),
      stringsAsFactors = FALSE)
    versions <- s[s$version %in% known_versions, ]
    visible_versions <- sort(unique(versions$version))
 }}}

 Could still be tweaked, but works (see atached png)

--

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/21196#comment:1>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
_______________________________________________
tor-bugs mailing list
tor-bugs@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs