// author: Fabian Hassler // year: 2019 // This module implements a list of colormaps // the code has been converted from the python library // matplotlib 3.0.2 license under BSD // Feel free to use or to modify the code // example: the generate a palette wistia // pen[] Palette = wistia.palette() // // There are two types of palettes. For a complete list see below: // // 1) The segmented palettes can be used as // .palette(int NColors=256, real gamma=1.) // NColors are the number of colors in the palette // gamma is the gamma-factor // // 2) The listed palettes can only be used as // .palette() // // Both functions return pen[] that can be used as a palette in the // module palette. // list of palettes // see also https://matplotlib.org/tutorials/colors/colormaps.html // segmented palettes: // CMRmap // autumn // binary // bone // cool // coolwarm // copper // gist_earth // gist_ncar // gist_stern // gray // hot // hsv // jet // nipy_spectral // pink // spring // summer // winter // wistia // listed palettes: // Accent // Blues // BrBG // BuGn // BuPu // Dark2 // GnBu // Greens // Greys // OrRd // Oranges // PRGn // Paired // Pastel1 // Pastel2 // PiYG // PuBuGn // PuBu // PuOr // PuRd // Purples // RdBu // RdGy // RdPu // RdYlBu // RdYlGn // Reds // Set1 // Set2 // Set3 // Spectral // YlGnBu // YlGn // YlOrBr // YlOrRd // brg // bwr // seismic // tab10 // tab20 // tab20b // tab20c // cividis // inferno // magma // plasma // twilight // twilight_shifted // viridis // Example of usage: // import graph; // import palette; // import colormap; // int NColors=5; // pen[] Palette=spring.palette(NColors); // palette(bounds(0,1),(0.,0),(500,50),Bottom,Palette); // // SOURCE CODE // private real[] makeMappingArray(int N, triple[] data, real gamma=1.) { real[] x; real[] y0; real[] y1; for (int i=0; i