1

I am currently using Plots package in Julia with pyplot as the backend. I can choose color_palette and make plots by

pyplot(color_palette=:delta)
Plots.plot(x, y)

What is the syntax to define and use a custom color palette according to, for example, Okade and Ito below, for color-blind-friendliness? Thanks! Okade and Ito color palette

Jen-Feng Hsu
  • 161
  • 11
  • 1
    You can see an example here https://github.com/baggepinnen/Savefig.jl/blob/069c231746a03c6902d17e1ea43fb66577d9d840/src/Savefig.jl#L12 – Fredrik Bagge Apr 16 '20 at 12:08

1 Answers1

6

Just pass a Vector of RGB - see the docs here https://docs.juliaplots.org/latest/colors/#Misc-1 But that particular palette is actually built into Plots - so you can get it by specifying theme(:wong2) before plotting, it will change the palette and color gradient for the duration of the session.

Michael K. Borregaard
  • 7,864
  • 1
  • 28
  • 35
  • Thanks! Was able to define OIcolor = [RGB(35. 70. 90.) ...] and invoke color=OIcolor in plots. Somehow my environment doesn't have :wong2. Invoking cgradients() yielded 6 palettes: :blues, :viridis, :pu_or, :magma, :plamsa, :inferno – Jen-Feng Hsu Apr 16 '20 at 18:32
  • 1
    Yes that functionality seems to have gone missing - you can always use `theme(:wong2)` though – Michael K. Borregaard Apr 17 '20 at 05:38
  • Note: theme(:wong2) works well in Julia 1.4.1. It did not work in Julia 1.2.0, as "Unknown key: colorgradient" error was thrown. – Jen-Feng Hsu Apr 27 '20 at 13:28
  • @Jen-FengHsu I think that's an issue with version mismatches between PlotUtils and PlotThemes, not a general julia-1.2 thing – Michael K. Borregaard Apr 28 '20 at 14:24