{"id":20296959,"url":"https://github.com/nbehrnd/moreland-gnuplot-palettes","last_synced_at":"2026-03-08T15:32:44.908Z","repository":{"id":154641984,"uuid":"225964469","full_name":"nbehrnd/moreland-gnuplot-palettes","owner":"nbehrnd","description":"A reformat of Kenneth Moreland's color palettes to work with them in gnuplot.","archived":false,"fork":false,"pushed_at":"2019-12-10T11:18:16.000Z","size":49455,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-14T09:57:56.226Z","etag":null,"topics":["gnuplot","moreland","palette","palette-colors","perception","visualization"],"latest_commit_sha":null,"homepage":null,"language":"Gnuplot","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nbehrnd.png","metadata":{"files":{"readme":"README.org","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-12-04T21:57:37.000Z","updated_at":"2023-07-26T14:35:03.000Z","dependencies_parsed_at":null,"dependency_job_id":"947eed2b-6d0a-473c-9c7a-8e000f180b20","html_url":"https://github.com/nbehrnd/moreland-gnuplot-palettes","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nbehrnd%2Fmoreland-gnuplot-palettes","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nbehrnd%2Fmoreland-gnuplot-palettes/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nbehrnd%2Fmoreland-gnuplot-palettes/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nbehrnd%2Fmoreland-gnuplot-palettes/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nbehrnd","download_url":"https://codeload.github.com/nbehrnd/moreland-gnuplot-palettes/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241794111,"owners_count":20021188,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gnuplot","moreland","palette","palette-colors","perception","visualization"],"created_at":"2024-11-14T15:42:20.750Z","updated_at":"2026-03-08T15:32:44.879Z","avatar_url":"https://github.com/nbehrnd.png","language":"Gnuplot","readme":"\n#+OPTIONS: toc:nil\n\n#+LATEX_CLASS:    koma-article  \n#+LATEX_HEADER:   \\usepackage[a4paper]{geometry}\n#+LATEX_HEADER:   \\usepackage{libertine, microtype, graphicx, float}\n#+LATEX_HEADER:   \\usepackage[USenglish]{babel}\n#+LATEX_HEADER:   \\usepackage[scaled=0.9]{inconsolata}\n#+LATEX_HEADER:   \\usepackage[libertine]{newtxmath}\n#+LATEX_HEADER:    \\usepackage[version=2]{mhchem}\n\n#+LATEX_HEADER:   \\setkomafont{captionlabel}{\\sffamily\\bfseries}\n#+LATEX_HEADER:   \\setcapindent{0em}  \\setkomafont{caption}{\\small}\n#+LATEX_HEADER:   \\usepackage[basicstyle=small]{listings}\n\n# date   2019-12-03 (YYYY-MM-DD)\n# edit:  2019-12-10 (YYYY-MM-DD)\n\n\n* Background\n\n  On his web page, Kenneth Moreland suggests a number of continuous\n  and diverge color palettes to improve scientific\n  visualization.[fn:1] Contrasting to other approaches, they aim for a\n  smooth variation of the hue between the extremes of a scale\n  displayed.  While this reduces the brightness of the colors to\n  choose from, their continuous transient hue offers a better visual\n  inspection already when print in color.  Contrasting to classical\n  \"jet\" or \"rainbow\" palettes (/vide infra/), they retain their\n  information if the output is constrained to gray scale (e.g., if\n  xeroxed).\n  \n  #+NAME:        appetizer\n  #+ATTR_LATEX:  :width 15cm\n  #+ATTR_HTML:   :width 75%\n  [[./doc/appetizer.png]]\n\n  Where possible, this project renders Kenneth Moreland's set of\n  =.cvs= palette information accessible to gnuplot as =.plt= files.\n\n* How to use the .plt palettes\n\n  The color palettes are provided with a varying number of explicitly\n  defined colors.  This range spans from eight up to 1024.  For\n  smaller color palettes, a copy-paste of their content into an\n  already existing gnuplot script file may be an option.  More\n  convenient however, especially while working with larger color\n  palettes, is to access them from gnuplot by adding the command\n  #+BEGIN_SRC shell\n    load \"example_palette.plt\"\n  #+END_SRC\n  at any point prior to the =[s]plot= instruction.\n\n  Each sub-folder contains the corresponding =.plt= files.  The number\n  in the file name indicates the number of explicitly defined colors\n  in the file.\n\n* Palettes at disposition\n\n  For the display of continuous data, conversions of eight color\n  palettes are provided: =black-body=, =extended-black-body=,\n  =inferno=, =kindlmann=, =extended-kindlmann=, =magma=, =plasma=, and\n  =viridis=.\n\n  On the other hand, palette =bent-cool-warm= is designed with diverge\n  data sets in mind where highlighting the transition across a\n  critical value is important.  This may be useful to indicate\n  relative velocities, or pressures below / above a threshold, for\n  example.  It is complemented by =smooth-cool-warm=.  While again\n  designed as diverging palette, the transition around the mid point\n  now is gradual.  Thus, for data close at this transition, expect\n  less detail displayed there with with palette =smooth-cool-warm= ,\n  than with palette =bent-cool-warm=. \\\\ \n\n  The display of the palette's action is based on synthetic data\n  computed for the Bessel function $f(x,y) = x^2 + y^2$ with a grid of\n  500 \\times 500 points in the (/x,y/)-plane.  1024 levels in the\n  orthogonal /z/-direction accommodate the highest number of\n  explicitly defined colors per palette file available ($n = 1024$).\n  Next to it, a diagram depicts how the =R=, =G=, and =B= channel sum\n  up to yield the =RGB= color displayed.  In addition, the NTSC\n  luminance value is traced.  This is indicative about how the\n  calculated result would look like for an output constrained to\n  gray-scale.  Thirdly you see the Bessel plot a twice, actually\n  simulating the gray-scale output.\n\n  #+NAME:       Moreland_black_body_1024\n  #+CAPTION:    Kenneth Moreland's continuous palette =black-body= used to display the Bessel function $f(x,y) = x^2 + y^2$.  This and the plots following are based on the explicit gnuplot instructions =set sample 500= and =set isosample 1024= to accommodate up to 1024 colors explicitly defined in the palettes.\n  #+ATTR_LATEX: :width 15cm   \n  #+ATTR_HTML:  :width 75%\n  [[./black-body/black-body-table-float-1024_test.png]]\n\n  #+NAME:       Moreland_extended_black_body_1024\n  #+CAPTION:    Application of Kenneth Moreland's continuous palette =extended-black-body=.\n  #+ATTR_LATEX:  :width 15cm\n  #+ATTR_HTML:   :width 75%\n  [[./extended-black-body/extended-black-body-table-float-1024_test.png]]\n\n  #+NAME:       Moreland_inferno_1024\n  #+CAPTION:    Application of Kenneth Moreland's continuous palette =inferno=.\n  #+ATTR_LATEX:  :width 15cm\n  #+ATTR_HTML:   :width 75%\n  [[./inferno/inferno-table-float-1024_test.png]]\n\n  #+NAME:       Moreland_kindlmann_1024\n  #+CAPTION:    Application of Kenneth Moreland's continuous palette =kindlmann=.\n  #+ATTR_LATEX:  :width 15cm\n  #+ATTR_HTML:   :width 75%\n  [[./kindlmann/kindlmann-table-float-1024_test.png]]\n\n  #+NAME:       Moreland_extended_kindlmann_1024\n  #+CAPTION:    Application of Kenneth Moreland's continuous palette =extended-kindlmann=.\n  #+ATTR_LATEX:  :width 15cm\n  #+ATTR_HTML:   :width 75%\n  [[./extended-kindlmann/extended-kindlmann-table-float-1024_test.png]]\n  \n  #+NAME:       Moreland_magma_1024\n  #+CAPTION:    Application of Kenneth Moreland's continuous palette =magma=.\n  #+ATTR_LATEX:  :width 15cm\n  #+ATTR_HTML:   :width 75%\n  [[./magma/magma-table-float-1024_test.png]]\n  \n  #+NAME:       Moreland_plasma_1024\n  #+CAPTION:    Application of Kenneth Moreland's continuous palette =plasma=.\n  #+ATTR_LATEX:  :width 15cm\n  #+ATTR_HTML:   :width 75%\n  [[./plasma/plasma-table-float-1024_test.png]]\n\n  #+NAME:       Moreland_viridis_1024\n  #+CAPTION:    Application of Kenneth Moreland's continuous palette =viridis=.\n  #+ATTR_LATEX:  :width 15cm\n  #+ATTR_HTML:   :width 75%\n  [[./viridis/viridis-table-float-1024_test.png]]\n\n  #+NAME:        Moreland_bent_cool_warm_1024\n  #+CAPTION:     Application of Kenneth Moreland's diverging palette =bent-cool-warm=, which accentuates the mid-point.\n  #+ATTR_LATEX:  :width 15cm\n  #+ATTR_HTML:   :width 75%\n  [[./bent-cool-warm/bent-cool-warm-table-float-1024_test.png]]\n\n  #+NAME:        Moreland_smooth_cool_warm_1024\n  #+CAPTION:     Application of Kenneth Moreland's diverging palette =smooth-cool-warm=.\n  #+ATTR_LATEX:  :width 15cm\n  #+ATTR_HTML:   :width 75%\n  [[./smooth-cool-warm/smooth-cool-warm-table-float-1024_test.png]]\n\n  #+LATEX:  \\clearpage{}\n\n* Comparison with other palettes\n  \n  A few palettes are compared to those provided by Moreland.  They\n  again rely on the high level of isosamples (=set iso 1024=) in /z/-,\n  and samples (=set samples 500=) in /x/- and /y/-direction.\n\n  Repositories like gnuplot-colorbrewer,[fn:2] and\n  gnuplot-palettes[fn:3] host alternative palettes, too.\n\n  + For the display of continuous data, either one of the following\n    instructions prior to the =[s]plot= instruction may initiate\n    palettes already included in gnuplot:\n    #+BEGIN_SRC shell\n      set palette gray   # gnuplot's gray palette\n      set pm3d map       # access to gnuplot's default rainbow palette\n      set palette cubehelix start 0 cycles -1. saturation 1\n    #+END_SRC\n    Note that palette =cubehelix= equally counters some cases of color\n    blindness, too.\n    \n    #+NAME:     manual_gray_1024\n    #+CAPTION:  Gnuplot's gray palette (=set palette gray=) displaying the Bessel function $f(x,y) = x^2 + y^2$.\n    #+ATTR_LATEX:  :width 15cm\n    #+ATTR_HTML:   :width 75%\n    [[./extra_palette_tests/manual_gray_1024_test.png]]\n\n    #+NAME:     manual_palette_1024\n    #+CAPTION:  Gnuplot's default rainbow palette (=set palette; set pm3d=).\n    #+ATTR_LATEX:  :width 15cm\n    #+ATTR_HTML:   :width 75%\n    [[./extra_palette_tests/manual_palette_1024_test.png]]\n\n    #+NAME:     manual_cubehelix_1024\n    #+CAPTION:  Gnuplot's =cubehelix= palette (=set palette cubehelix start 0 cycles -1. saturation 1=)\n    #+ATTR_LATEX:  :width 15cm\n    #+ATTR_HTML:   :width 75%\n    [[./extra_palette_tests/manual_cubehelix_1024_test.png]]\n\n    #+LATEX:  \\clearpage{}\n\n    As a contrasting example, =jet.pal= (provided by [[https://github.com/Gnuplotting/gnuplot-palettes][gnuplot-palettes]])\n    mimics an elder matlab default palette with the perceptual\n    problems meanwhile addressed by palettes by Moreland and others.\n    address.  Its definitions relevant here are:\n    #+BEGIN_SRC shell\n    set palette defined (0  0.0 0.0 0.5, \\\n                     1  0.0 0.0 1.0, \\\n                     2  0.0 0.5 1.0, \\\n                     3  0.0 1.0 1.0, \\\n                     4  0.5 1.0 0.5, \\\n                     5  1.0 1.0 0.0, \\\n                     6  1.0 0.5 0.0, \\\n                     7  1.0 0.0 0.0, \\\n                     8  0.5 0.0 0.0 )\n    #+END_SRC\n    \n    #+NAME:      manual_jet_1024\n    #+CAPTION:  Display of the same Bessel function with defined with the external =jet.pal= palette from gnuplotting.org's repository.  Note how the ease to assign levels from the reference bar to the map is depends on the color-space accessed.\n    #+ATTR_LATEX:   :width 15cm\n    #+ATTR_HTML:    :width 75%\n    [[./extra_palette_tests/manual_jet_1024_test.png]]\n\n  + For diverge data, using a blue-white-red transient is a good\n    choice /to begin with/.  For the RGB color space by the pngcairo\n    terminal, these palettes may be defined by 'named colors' as with\n    either of the example instructions below.  Similar as seen with\n    Moreland's palettes, it is helpful to decrease the maximal\n    luminosity, though (second example).\n    #+BEGIN_SRC shell\n      set palette defined (-1 \"blue\", 0 \"white\", 1 \"red\")\n      set palette defined (-1 \"blue\", 0 \"light-gray\", 1 \"red\")\n    #+END_SRC\n    \n    #+NAME:    manual_rainbow_blue_white_red_1024\n    #+CAPTION: Manually set up diverging blue--white-red color palette displaying the Bessel function.\n    #+ATTR_LATEX:  :width 15cm\n    #+ATTR_HTML:   :width 75%\n    [[./extra_palette_tests/manual_blue_white_red_1024_test.png]]\n\n    #+NAME:    manual_rainbow_blue_light-gray_red_1024\n    #+CAPTION: Slightly improved version of the earlier diverging three-level color palette by exchange of \"white\" by \"light-gray\" as central transition.\n    #+ATTR_LATEX:  :width 15cm\n    #+ATTR_HTML:   :width 75%\n    [[./extra_palette_tests/manual_blue_light-gray_red_1024_test.png]]\n  \n* Generation of the data\n\n  Departing from Moreland's RGB palettes defined as /floating\n  numbers/, script =csv2plt.py= (sub-folder =tools=) reformatted the\n  entries to five decimals.  Script =RGB_check.py= provided a control\n  if the RGB tuples converted stay within the permitted interval of\n  $[0,1]$.\n\n  Script =palette_decomposition.py= provided a quick channel-wise\n  decomposition of the RGB color space, complemented by the NTSC\n  luminosity.  Each synopsis per =.plt= file displays this result in\n  between the test plots in color and gray-scale.\n\n  Script =bessel_test_center.py= computed the synthetic data of the\n  Bessel function $f(x,y) = x^2 + y^2$ eventually displayed as color\n  plot.  It called ImageMagick to convert this result into gray-scale,\n  and concatenated the two plots with the diagram by\n  =palette_decomposition.py=.\n\n* Comparison of similar palettes\n\n  Gnuplot's rapid scrutiny about the contribution of =R=, =G=, and =B=\n  channel of a palette, reported as =.png=, allows a programmatic\n  visual comparison of palettes with each other.  This task addressed\n  by script =vignette_comparison.py=, to be run right after\n  =palette_decomposition.py=, without provision of parameters from the\n  CLI by\n  #+BEGIN_SRC shell\n    python3 vignette_comparison.py\n  #+END_SRC\n  \n  Each pairwise comparison yields a new file named in the pattern of\n  =diff_fileA_fileB.png=.  Differences identified by ImageMagick will\n  be indicated with bright red pixels.  This reveals, for example,\n  palette =magma.pal= provided by gnuplotting.org[fn:4] /\n  [[https://github.com/Gnuplotting/gnuplot-palettes][gnuplot-palettes]] differs from all =magma.plt= definitions derived\n  from Kenneth Moreland's palettes based on floating numbers in this\n  repository as illustrated below, or with animation =magma_diff.gif=\n  (in sub-folder =extra_palette_tests=).\n\n  #+NAME:       magma_testing\n  #+CAPTION:    Comparison of two =magma= palettes: Kenneth Moreland's =magma= palette (256 colors, floating RGB definition, left hand side).  Gnuplotting's definition of =magma= (256 colors, floating RGB definition, center).  Difference plot by ImageMagick's =compare= of the two former (right hand).\n  #+ATTR_LATEX: :width 15cm\n  #+ATTR_HTML:  :width 75%\n  [[./extra_palette_tests/magma_testing/synopsis_magma_palettes.png]]\n\n  Sub-folder =extra_palette_tests/magma_testing/= includes further\n  details about this analysis and an animated =.gif= about all tests\n  performed relevant here.  This and all other data processing was\n  run under Linux (Xubuntu 18.04.3 LTS) with CPython (3.6.8,\n  October 7, 2019), gnuplot (5.2.7beta, last modified 2019-05-14), and\n  ImageMagick (6.9.7-4 Q16).\n\n* Vector-based export\n\n  It is possible to engage gnuplot's =set terminal pdfcairo=\n  instruction to provide a native export of the results as the\n  resolution independent =.pdf= format.  This was tested for the\n  palette maps of 512 explicitly defined colors with now 256 iso\n  samples computed by gnuplot for the same Bessel function.  While\n  this document contains only the example for the continuously smooth\n  viridis palette, tests with this and the other palettes are stored\n  in sub-folder =pdf-tests=.\n\n  #+NAME:    viridis_pdf_test\n  #+CAPTION: Test of Kenneth Moreland's RGB definition of palette =viridis-table-float-0512= with gnuplot's =set terminal pdfcairo= instruction and 256 isosamples.\n  #+ATTR_LATEX: :width 15cm\n  #+ATTR_HTML:  :width 75%\n  [[./pdf_tests/viridis-table-float-0512_test.pdf]]\n\n  #+LATEX:  \\begin{center} $\\diamond{}$ \\end{center}\n\n* Footnotes\n[fn:1] http://www.kennethmoreland.com/color-advice/\n[fn:2] https://github.com/aschn/gnuplot-colorbrewer\n[fn:3] https://github.com/Gnuplotting/gnuplot-palettes\n[fn:4] http://www.gnuplotting.org/\n\n  \n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnbehrnd%2Fmoreland-gnuplot-palettes","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnbehrnd%2Fmoreland-gnuplot-palettes","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnbehrnd%2Fmoreland-gnuplot-palettes/lists"}