MCPcopy Create free account
hub / github.com/alandefreitas/matplotplusplus / default_colors_map

Function default_colors_map

source/matplot/util/colors.cpp:2996–3014  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2994 return result;
2995 }
2996 std::vector<std::vector<double>> default_colors_map(size_t n) {
2997 static std::vector<std::vector<double>> map = {
2998 {0, 0.447, 0.741}, {0.85, 0.325, 0.098},
2999 {0.929, 0.694, 0.125}, {0.494, 0.184, 0.556},
3000 {0.466, 0.674, 0.188}, {0.301, 0.745, 0.933},
3001 {0.635, 0.078, 0.184}};
3002 if (n == 7) {
3003 return map;
3004 }
3005 std::vector<std::vector<double>> result;
3006 for (size_t i = 0; i < n; ++i) {
3007 std::array<float, 4> ac =
3008 colormap_interpolation(static_cast<double>(i), 0.,
3009 static_cast<double>(n - 1), map);
3010 std::vector<double> vc = {ac[1], ac[2], ac[3]};
3011 result.emplace_back(vc);
3012 }
3013 return result;
3014 }
3015
3016 } // namespace palette
3017

Callers 1

wordcloudMethod · 0.85

Calls 1

colormap_interpolationFunction · 0.85

Tested by

no test coverage detected