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

[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                    |   Keywords:
Actual Points:                           |  Parent ID:
       Points:                           |   Reviewer:
      Sponsor:                           |
-----------------------------------------+--------------------------
 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)

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/21196>
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