Commit 3fe18153 authored by Paul Asmuth's avatar Paul Asmuth
Browse files

add the 'zhang' color palette

parent 83a0df55
Loading
Loading
Loading
Loading
+19 −0
Original line number Original line Diff line number Diff line
@@ -19,6 +19,8 @@ const std::unordered_map<
    std::string_view,
    std::string_view,
    std::vector<std::string_view>>
    std::vector<std::string_view>>
    COLOR_PALETTES = {
    COLOR_PALETTES = {

  // the "fnordmetric" color palette
  {
  {
    "fnord",
    "fnord",
    {
    {
@@ -29,7 +31,24 @@ const std::unordered_map<
      "#80699b",
      "#80699b",
      "#3d96ae",
      "#3d96ae",
    }
    }
  },

  // the "zhang" color palette
  // source: https://www.nature.com/articles/s41586-019-1364-3
  {
    "zhang",
    {
      "#6a88c4",
      "#75c042",
      "#efeb52",
      "#f5a325",
      "#f92d23",
      "#9551a1",
      "#323085",
      "#a2a2a2",
    }
  }
  }

};
};


ReturnCode color_palette_default(const std::string& name, ColorPalette* colors) {
ReturnCode color_palette_default(const std::string& name, ColorPalette* colors) {
+22 −8
Original line number Original line Diff line number Diff line
(set height 220px)
(set height 220px)
(set width 960px)
(set width 960px)
(set color-palette zhang)


(plot
(plot
  limit-x (0 100)
  limit-x (0 100)
  limit-y (0 60)
  limit-y (0 70)
  axes (bottom)
  axes (bottom)
  axis-y-label-placement (linear-interval 10 10 50)
  axis-y-label-placement (linear-interval 10 10 60)
  axis-left (
  axis-left (
    border none
    border none
    label-offset 0
    label-offset 0
    label-attach left
    label-attach left
    label-color #666)
    label-color #666)
  areas (
    data-x (5 10 20 30 40 50 60 70 80 90 100)
    data-y (7 13 17 27 38 39 52 59 48 60 65)
    color 5)
  areas (
    data-x (5 10 20 30 40 50 60 70 80 90 100)
    data-y (4 12 15 22 35 38 47 47 42 53 60)
    color 4)
  areas (
  areas (
    data-x (5 10 20 30 40 50 60 70 80 90 100)
    data-x (5 10 20 30 40 50 60 70 80 90 100)
    data-y (3 10 10 18 32 34 42 40 36 46 54)
    data-y (3 10 10 18 32 34 42 40 36 46 54)
    color 1)
    color 3)
  areas (
  areas (
    data-x (5 10 20 30 40 50 60 70 80 90 100)
    data-x (5 10 20 30 40 50 60 70 80 90 100)
    data-y (2 6 6 8 18 20 30 30 30 36 35)
    data-y (2 6 6 8 18 20 30 30 30 36 35)
    color 3)
    color 2)
  areas (
  areas (
    data-x (5 10 20 30 40 50 60 70 80 90 100)
    data-x (5 10 20 30 40 50 60 70 80 90 100)
    data-y (1 2 4 7 13 15 20 16 18 23 18)
    data-y (1 2 4 7 13 15 20 16 18 23 18)
    color 2)
    color 1)
  grid (
  grid (
    color #eee
    color #eee
    tick-placement-x (none))
    tick-placement-x (none))
  legend-top (
  legend-top (
    position (top right)
    position (top left)
    margin-left 0
    margin 0
    padding 0
    item-flow on
    item-flow on
    item (label "Series A" color 1)
    item (label "Series A" color 1)
    item (label "Series B" color 2)
    item (label "Series B" color 2)
    item (label "Series C" color 3)))
    item (label "Series C" color 3)
    item (label "Series D" color 4)
    item (label "Series E" color 5)))

+27 −19
Original line number Original line Diff line number Diff line
<svg xmlns="http://www.w3.org/2000/svg" width="960.000000" height="220.000000" viewBox="0 0 960 220">
<svg xmlns="http://www.w3.org/2000/svg" width="960.000000" height="220.000000" viewBox="0 0 960 220">
  <rect width="960.000000" height="220.000000" fill="#ffffff"/>
  <rect width="960.000000" height="220.000000" fill="#ffffff"/>
  <path stroke-width="1.333333" stroke="#eeeeee" fill="none" d="M54.9469 154.711 L945.333 154.711 "/>
  <path stroke-width="1.333333" stroke="#eeeeee" fill="none" d="M54.9469 155.181 L945.333 155.181 "/>
  <path stroke-width="1.333333" stroke="#eeeeee" fill="none" d="M54.9469 133.822 L945.333 133.822 "/>
  <path stroke-width="1.333333" stroke="#eeeeee" fill="none" d="M54.9469 134.762 L945.333 134.762 "/>
  <path stroke-width="1.333333" stroke="#eeeeee" fill="none" d="M54.9469 112.933 L945.333 112.933 "/>
  <path stroke-width="1.333333" stroke="#eeeeee" fill="none" d="M54.9469 114.343 L945.333 114.343 "/>
  <path stroke-width="1.333333" stroke="#eeeeee" fill="none" d="M54.9469 92.0444 L945.333 92.0444 "/>
  <path stroke-width="1.333333" stroke="#eeeeee" fill="none" d="M54.9469 93.9238 L945.333 93.9238 "/>
  <path stroke-width="1.333333" stroke="#eeeeee" fill="none" d="M54.9469 71.1556 L945.333 71.1556 "/>
  <path stroke-width="1.333333" stroke="#eeeeee" fill="none" d="M54.9469 73.5048 L945.333 73.5048 "/>
  <path fill="#4572a7" d="M99.4662 169.333 L143.986 154.711 L233.024 154.711 L322.063 138 L411.101 108.756 L500.14 104.578 L589.179 87.8667 L678.217 92.0444 L767.256 100.4 L856.295 79.5111 L945.333 62.8 L945.333 175.6 L856.295 175.6 L767.256 175.6 L678.217 175.6 L589.179 175.6 L500.14 175.6 L411.101 175.6 L322.063 175.6 L233.024 175.6 L143.986 175.6 L99.4662 175.6 Z"/>
  <path stroke-width="1.333333" stroke="#eeeeee" fill="none" d="M54.9469 53.0857 L945.333 53.0857 "/>
  <path fill="#db843d" d="M99.4662 171.422 L143.986 163.067 L233.024 163.067 L322.063 158.889 L411.101 138 L500.14 133.822 L589.179 112.933 L678.217 112.933 L767.256 112.933 L856.295 100.4 L945.333 102.489 L945.333 175.6 L856.295 175.6 L767.256 175.6 L678.217 175.6 L589.179 175.6 L500.14 175.6 L411.101 175.6 L322.063 175.6 L233.024 175.6 L143.986 175.6 L99.4662 175.6 Z"/>
  <path fill="#f92d23" d="M99.4662 161.307 L143.986 149.055 L233.024 140.888 L322.063 120.469 L411.101 98.0076 L500.14 95.9657 L589.179 69.421 L678.217 55.1276 L767.256 77.5886 L856.295 53.0857 L945.333 42.8762 L945.333 175.6 L856.295 175.6 L767.256 175.6 L678.217 175.6 L589.179 175.6 L500.14 175.6 L411.101 175.6 L322.063 175.6 L233.024 175.6 L143.986 175.6 L99.4662 175.6 Z"/>
  <path fill="#aa4643" d="M99.4662 173.511 L143.986 171.422 L233.024 167.244 L322.063 160.978 L411.101 148.444 L500.14 144.267 L589.179 133.822 L678.217 142.178 L767.256 138 L856.295 127.556 L945.333 138 L945.333 175.6 L856.295 175.6 L767.256 175.6 L678.217 175.6 L589.179 175.6 L500.14 175.6 L411.101 175.6 L322.063 175.6 L233.024 175.6 L143.986 175.6 L99.4662 175.6 Z"/>
  <path fill="#f5a325" d="M99.4662 167.432 L143.986 151.097 L233.024 144.971 L322.063 130.678 L411.101 104.133 L500.14 98.0076 L589.179 79.6305 L678.217 79.6305 L767.256 89.84 L856.295 67.379 L945.333 53.0857 L945.333 175.6 L856.295 175.6 L767.256 175.6 L678.217 175.6 L589.179 175.6 L500.14 175.6 L411.101 175.6 L322.063 175.6 L233.024 175.6 L143.986 175.6 L99.4662 175.6 Z"/>
  <text x="682.173958" y="46.266667" fill="#000000" font-size="14.666667" font-family="Arial,Helvetica,'Helvetica Neue',sans-serif" font-weight="500.000000">Series A</text>
  <path fill="#efeb52" d="M99.4662 169.474 L143.986 155.181 L233.024 155.181 L322.063 138.846 L411.101 110.259 L500.14 106.175 L589.179 89.84 L678.217 93.9238 L767.256 102.091 L856.295 81.6724 L945.333 65.3371 L945.333 175.6 L856.295 175.6 L767.256 175.6 L678.217 175.6 L589.179 175.6 L500.14 175.6 L411.101 175.6 L322.063 175.6 L233.024 175.6 L143.986 175.6 L99.4662 175.6 Z"/>
  <path fill="#4572a7" d="M673.741 41.2667 M662.741 41.2667 a5.5 5.5 0 1 0 11 0 a5.5 5.5 0 1 0 -11 0 "/>
  <path fill="#75c042" d="M99.4662 171.516 L143.986 163.349 L233.024 163.349 L322.063 159.265 L411.101 138.846 L500.14 134.762 L589.179 114.343 L678.217 114.343 L767.256 114.343 L856.295 102.091 L945.333 104.133 L945.333 175.6 L856.295 175.6 L767.256 175.6 L678.217 175.6 L589.179 175.6 L500.14 175.6 L411.101 175.6 L322.063 175.6 L233.024 175.6 L143.986 175.6 L99.4662 175.6 Z"/>
  <text x="773.481250" y="46.266667" fill="#000000" font-size="14.666667" font-family="Arial,Helvetica,'Helvetica Neue',sans-serif" font-weight="500.000000">Series B</text>
  <path fill="#6a88c4" d="M99.4662 173.558 L143.986 171.516 L233.024 167.432 L322.063 161.307 L411.101 149.055 L500.14 144.971 L589.179 134.762 L678.217 142.93 L767.256 138.846 L856.295 128.636 L945.333 138.846 L945.333 175.6 L856.295 175.6 L767.256 175.6 L678.217 175.6 L589.179 175.6 L500.14 175.6 L411.101 175.6 L322.063 175.6 L233.024 175.6 L143.986 175.6 L99.4662 175.6 Z"/>
  <path fill="#aa4643" d="M765.048 41.2667 M754.048 41.2667 a5.5 5.5 0 1 0 11 0 a5.5 5.5 0 1 0 -11 0 "/>
  <text x="71.080208" y="28.666667" fill="#000000" font-size="14.666667" font-family="Arial,Helvetica,'Helvetica Neue',sans-serif" font-weight="500.000000">Series A</text>
  <text x="865.601042" y="46.266667" fill="#000000" font-size="14.666667" font-family="Arial,Helvetica,'Helvetica Neue',sans-serif" font-weight="500.000000">Series C</text>
  <path fill="#6a88c4" d="M62.6469 23.6667 M51.6469 23.6667 a5.5 5.5 0 1 0 11 0 a5.5 5.5 0 1 0 -11 0 "/>
  <path fill="#db843d" d="M857.168 41.2667 M846.168 41.2667 a5.5 5.5 0 1 0 11 0 a5.5 5.5 0 1 0 -11 0 "/>
  <text x="162.387500" y="28.666667" fill="#000000" font-size="14.666667" font-family="Arial,Helvetica,'Helvetica Neue',sans-serif" font-weight="500.000000">Series B</text>
  <path fill="#75c042" d="M153.954 23.6667 M142.954 23.6667 a5.5 5.5 0 1 0 11 0 a5.5 5.5 0 1 0 -11 0 "/>
  <text x="254.507292" y="28.666667" fill="#000000" font-size="14.666667" font-family="Arial,Helvetica,'Helvetica Neue',sans-serif" font-weight="500.000000">Series C</text>
  <path fill="#efeb52" d="M246.074 23.6667 M235.074 23.6667 a5.5 5.5 0 1 0 11 0 a5.5 5.5 0 1 0 -11 0 "/>
  <text x="347.439583" y="28.666667" fill="#000000" font-size="14.666667" font-family="Arial,Helvetica,'Helvetica Neue',sans-serif" font-weight="500.000000">Series D</text>
  <path fill="#f5a325" d="M339.006 23.6667 M328.006 23.6667 a5.5 5.5 0 1 0 11 0 a5.5 5.5 0 1 0 -11 0 "/>
  <text x="440.371875" y="28.666667" fill="#000000" font-size="14.666667" font-family="Arial,Helvetica,'Helvetica Neue',sans-serif" font-weight="500.000000">Series E</text>
  <path fill="#f92d23" d="M431.939 23.6667 M420.939 23.6667 a5.5 5.5 0 1 0 11 0 a5.5 5.5 0 1 0 -11 0 "/>
  <path stroke-width="1.333333" stroke="#000000" fill="none" d="M54.9469 175.6 L945.333 175.6 "/>
  <path stroke-width="1.333333" stroke="#000000" fill="none" d="M54.9469 175.6 L945.333 175.6 "/>
  <path stroke-width="1.333333" stroke="#000000" fill="none" d="M54.9469 170.267 L54.9469 175.6 "/>
  <path stroke-width="1.333333" stroke="#000000" fill="none" d="M54.9469 170.267 L54.9469 175.6 "/>
  <path stroke-width="1.333333" stroke="#000000" fill="none" d="M143.986 170.267 L143.986 175.6 "/>
  <path stroke-width="1.333333" stroke="#000000" fill="none" d="M143.986 170.267 L143.986 175.6 "/>
@@ -37,9 +44,10 @@
  <text x="752.982615" y="201.333333" fill="#000000" font-size="14.666667" font-family="Arial,Helvetica,'Helvetica Neue',sans-serif" font-weight="500.000000">80.0</text>
  <text x="752.982615" y="201.333333" fill="#000000" font-size="14.666667" font-family="Arial,Helvetica,'Helvetica Neue',sans-serif" font-weight="500.000000">80.0</text>
  <text x="842.021282" y="201.333333" fill="#000000" font-size="14.666667" font-family="Arial,Helvetica,'Helvetica Neue',sans-serif" font-weight="500.000000">90.0</text>
  <text x="842.021282" y="201.333333" fill="#000000" font-size="14.666667" font-family="Arial,Helvetica,'Helvetica Neue',sans-serif" font-weight="500.000000">90.0</text>
  <text x="926.981771" y="201.333333" fill="#000000" font-size="14.666667" font-family="Arial,Helvetica,'Helvetica Neue',sans-serif" font-weight="500.000000">100.0</text>
  <text x="926.981771" y="201.333333" fill="#000000" font-size="14.666667" font-family="Arial,Helvetica,'Helvetica Neue',sans-serif" font-weight="500.000000">100.0</text>
  <text x="54.946875" y="159.711111" fill="#666666" font-size="14.666667" font-family="Arial,Helvetica,'Helvetica Neue',sans-serif" font-weight="500.000000">10.0</text>
  <text x="54.946875" y="160.180952" fill="#666666" font-size="14.666667" font-family="Arial,Helvetica,'Helvetica Neue',sans-serif" font-weight="500.000000">10.0</text>
  <text x="54.946875" y="138.822222" fill="#666666" font-size="14.666667" font-family="Arial,Helvetica,'Helvetica Neue',sans-serif" font-weight="500.000000">20.0</text>
  <text x="54.946875" y="139.761905" fill="#666666" font-size="14.666667" font-family="Arial,Helvetica,'Helvetica Neue',sans-serif" font-weight="500.000000">20.0</text>
  <text x="54.946875" y="117.933333" fill="#666666" font-size="14.666667" font-family="Arial,Helvetica,'Helvetica Neue',sans-serif" font-weight="500.000000">30.0</text>
  <text x="54.946875" y="119.342857" fill="#666666" font-size="14.666667" font-family="Arial,Helvetica,'Helvetica Neue',sans-serif" font-weight="500.000000">30.0</text>
  <text x="54.946875" y="97.044444" fill="#666666" font-size="14.666667" font-family="Arial,Helvetica,'Helvetica Neue',sans-serif" font-weight="500.000000">40.0</text>
  <text x="54.946875" y="98.923810" fill="#666666" font-size="14.666667" font-family="Arial,Helvetica,'Helvetica Neue',sans-serif" font-weight="500.000000">40.0</text>
  <text x="54.946875" y="76.155556" fill="#666666" font-size="14.666667" font-family="Arial,Helvetica,'Helvetica Neue',sans-serif" font-weight="500.000000">50.0</text>
  <text x="54.946875" y="78.504762" fill="#666666" font-size="14.666667" font-family="Arial,Helvetica,'Helvetica Neue',sans-serif" font-weight="500.000000">50.0</text>
  <text x="54.946875" y="58.085714" fill="#666666" font-size="14.666667" font-family="Arial,Helvetica,'Helvetica Neue',sans-serif" font-weight="500.000000">60.0</text>
</svg>
</svg>
 No newline at end of file
+14 −1
Original line number Original line Diff line number Diff line
@@ -66,7 +66,7 @@ List of default color palettes


The following color palletes are built in and can be referenced by name:
The following color palletes are built in and can be referenced by name:


<table>
<table class="plain">
  <tr>
  <tr>
    <td><code>fnord</code></td>
    <td><code>fnord</code></td>
    <td>
    <td>
@@ -78,5 +78,18 @@ The following color palletes are built in and can be referenced by name:
      <span style="color: #3d96ae;" class="color_legend"><small>6</small></span>
      <span style="color: #3d96ae;" class="color_legend"><small>6</small></span>
    </td>
    </td>
  </tr>
  </tr>
  <tr>
    <td><code>zhang</code></td>
    <td>
      <span style="color: #6a88c4;" class="color_legend"><small>1</small></span>
      <span style="color: #75c042;" class="color_legend"><small>2</small></span>
      <span style="color: #efeb52;" class="color_legend"><small>3</small></span>
      <span style="color: #f5a325;" class="color_legend"><small>4</small></span>
      <span style="color: #f92d23;" class="color_legend"><small>5</small></span>
      <span style="color: #9551a1;" class="color_legend"><small>6</small></span>
      <span style="color: #323085;" class="color_legend"><small>7</small></span>
      <span style="color: #a2a2a2;" class="color_legend"><small>8</small></span>
    </td>
  </tr>
</table>
</table>
+1 −1
Original line number Original line Diff line number Diff line
@@ -446,7 +446,7 @@ table th i {
  font-size: 12px;
  font-size: 12px;
}
}


table tr:nth-child(2n+0) { background-color: #f8f8f8; }
table:not(.plain) tr:nth-child(2n+0) { background-color: #f8f8f8; }


table td p {
table td p {
  margin-bottom: 0;
  margin-bottom: 0;
Loading