Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 5 additions & 9 deletions REUSE.toml
Original file line number Diff line number Diff line change
Expand Up @@ -136,12 +136,6 @@ precedence = "override"
SPDX-FileCopyrightText = "Michael Waskom"
SPDX-License-Identifier = "BSD-3-Clause"

[[annotations]]
path = "src/cmap/data/tableau/**"
precedence = "override"
SPDX-FileCopyrightText = "Maureen Stone, Cristy Miller"
SPDX-License-Identifier = "BSD-3-Clause"

[[annotations]]
path = "src/cmap/data/tol/**"
precedence = "override"
Expand Down Expand Up @@ -178,7 +172,9 @@ precedence = "override"
SPDX-FileCopyrightText = "Matthew A. Petroff"
SPDX-License-Identifier = "CC0-1.0"

# NOTE: okabeito and matlab have no formal license. Okabe-Ito color values are
# freely shared with an attribution request (not a formal license). The matlab
# NOTE: okabeito, matlab and tableau have no formal license. Okabe-Ito color values
# are freely shared with an attribution request (not a formal license). The matlab
# colormaps are trivial mathematical formulas independently re-implemented across
# many projects. Both fall through to the project default for now.
# many projects. Tableau has not published a license for its palettes (which are
# also redistributed by d3, Vega and matplotlib). All fall through to the project
# default for now.
9 changes: 6 additions & 3 deletions src/cmap/_catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def _build_catalog(records: Iterable[FileDescriptorOrPath]) -> CatalogDict:
if NAMESPACE_DELIMITER not in v["alias"]: # pragma: no cover
raise ValueError(f"{namespaced!r} alias is not namespaced")
ctlg[namespaced] = v
ctlg[name] = v # FIXME
ctlg[name] = {**v} # FIXME
continue

# here we add any global keys to the colormap that are not already there.
Expand All @@ -183,9 +183,12 @@ def _build_catalog(records: Iterable[FileDescriptorOrPath]) -> CatalogDict:
ctlg[name] = {"alias": namespaced, "conflicts": []}
else:
# if the short name is already in the catalog, we have a conflict.
# add the fully namespaced name to the conflicts list.
# add the fully namespaced name to the conflicts list (unless the
# short name is already an alias for this very colormap, e.g. from
# another namespace's backwards-compatibility alias).
entry = cast("UnloadedCatalogAlias", ctlg[name])
entry.setdefault("conflicts", []).append(namespaced)
if entry.get("alias") != namespaced:
entry.setdefault("conflicts", []).append(namespaced)

# lastly, the `aliases` key of a colormap refers to aliases within the
# namespace. These are keys that *must* be accessed using the fully
Expand Down
3 changes: 1 addition & 2 deletions src/cmap/data/cmocean/record.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"authors": [
""
"Kristen M. Thyng"
],
"colormaps": {
"algae": {
Expand Down Expand Up @@ -104,7 +104,6 @@
"data": "cmap.data.cmocean.turbid:turbid"
}
},
"info": "",
"license": "MIT",
"namespace": "cmocean",
"source": "https://github.com/matplotlib/cmocean"
Expand Down
3 changes: 2 additions & 1 deletion src/cmap/data/cubehelix/record.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"authors": [
""
"Dave Green",
"James Davenport"
],
"colormaps": {
"cubehelix": {
Expand Down
1 change: 1 addition & 0 deletions src/cmap/data/ibm/record.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
}
},
"info": "Color palettes for data visualizations from the IBM Design Language. Designed to maximize accessibility and harmony within a page.",
"license": "Apache-2.0",
"namespace": "ibm",
"source": "https://carbondesignsystem.com/data-visualization/color-palettes/#categorical-palettes"
}
4 changes: 3 additions & 1 deletion src/cmap/data/paraview/record.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,7 @@
}
},
"info": "Color maps of the ParaView platform for interactive, scientific visualization.",
"namespace": "paraview"
"license": "BSD-3-Clause",
"namespace": "paraview",
"source": "https://github.com/Kitware/ParaView"
}
1 change: 1 addition & 0 deletions src/cmap/data/petroff/record.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
}
},
"info": "Color sequences generated using a data-driven aesthetic-preference model and accessibility constraints.",
"license": "CC0",
"namespace": "petroff",
"source": "https://arxiv.org/abs/2107.02270"
}
31 changes: 29 additions & 2 deletions src/cmap/data/seaborn/record.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"authors": [
"John Doe"
"Michael Waskom"
],
"colormaps": {
"crest": {
Expand All @@ -23,12 +23,39 @@
"category": "sequential",
"data": "cmap.data.seaborn:rocket"
},
"tab10": {
"alias": "tableau:tab10"
},
"tab10_colorblind": {
"alias": "tableau:tab10_colorblind"
},
"tab10_light": {
"alias": "tableau:tab10_light"
},
"tab10_medium": {
"alias": "tableau:tab10_medium"
},
"tab10_new": {
"alias": "tableau:tab10_new"
},
"tab20": {
"alias": "tableau:tab20"
},
"tab20b": {
"alias": "tableau:tab20b"
},
"tab20c": {
"alias": "tableau:tab20c"
},
"tab_traffic_light": {
"alias": "tableau:tab_traffic_light"
},
"vlag": {
"category": "diverging",
"data": "cmap.data.seaborn:vlag"
}
},
"info": "This is a test dataset",
"info": "Colormaps from seaborn, the statistical data visualization library.",
"license": "BSD-3-Clause",
"namespace": "seaborn",
"source": "https://github.com/mwaskom/seaborn"
Expand Down
39 changes: 29 additions & 10 deletions src/cmap/data/tableau/record.json
Original file line number Diff line number Diff line change
@@ -1,49 +1,68 @@
{
"authors": [
"Maureen Stone",
"Cristy Miller"
],
"category": "qualitative",
"colormaps": {
"tab10": {
"authors": [
"Maureen Stone"
],
"data": "cmap.data.tableau:Tableau10",
"info": "Tableau's classic \"Tableau 10\" palette, designed by Maureen Stone in 2004 for Tableau 1.5. Also d3's `category10` and matplotlib's `tab10` (its default color cycle).",
"interpolation": false
},
"tab10_colorblind": {
"data": "cmap.data.tableau:ColorBlind10",
"info": "Tableau's \"Color Blind 10\" palette. Nearly identical to matplotlib's `tableau-colorblind10` style.",
"interpolation": false
},
"tab10_light": {
"data": "cmap.data.tableau:Tableau10_Light",
"info": "Tableau's \"Tableau 10 Light\" palette.",
"interpolation": false
},
"tab10_medium": {
"data": "cmap.data.tableau:Tableau10_Medium",
"info": "Tableau's \"Tableau 10 Medium\" palette.",
"interpolation": false
},
"tab10_new": {
"authors": [
"Maureen Stone",
"Cristy Miller"
],
"data": "cmap.data.tableau:Tableau10_New",
"info": "The \"Tableau 10\" palette as redesigned for Tableau 10 (2016) by Maureen Stone and Cristy Miller. Nearly identical to d3's `schemeTableau10`.",
"interpolation": false
},
"tab20": {
"authors": [
"Maureen Stone"
],
"data": "cmap.data.tableau:Tableau20",
"info": "Tableau's classic \"Tableau 20\" palette: light and dark pairs of the Tableau 10 hues. Also d3's `category20` and matplotlib's `tab20`.",
"interpolation": false
},
"tab20b": {
"authors": [],
"data": "cmap.data.tableau:Tableau20b",
"interpolation": false
"info": "d3's `category20b` palette (also matplotlib's `tab20b`).",
"interpolation": false,
"source": "https://github.com/d3/d3-3.x-api-reference/blob/master/Ordinal-Scales.md"
},
"tab20c": {
"authors": [],
"data": "cmap.data.tableau:Tableau20c",
"interpolation": false
"info": "d3's `category20c` palette (also matplotlib's `tab20c`).",
"interpolation": false,
"source": "https://github.com/d3/d3-3.x-api-reference/blob/master/Ordinal-Scales.md"
},
"tab_traffic_light": {
"data": "cmap.data.tableau:Traffic_Light",
"info": "Tableau's \"Traffic Light\" palette.",
"interpolation": false
}
},
"info": "This is a test dataset",
"license": "BSD-3-Clause",
"namespace": "seaborn",
"source": "https://public.tableau.com/views/TableauColors/ColorPaletteswithRGBValues"
"info": "Categorical palettes from Tableau. The basic palettes (like Tableau 10 and Tableau 20) were designed by Maureen Stone in 2004 for Tableau 1.5 (https://www.tableau.com/research/people/maureen-stone), and all of them were redesigned for Tableau 10 in 2016 (https://www.tableau.com/blog/colors-upgrade-tableau-10-56782).",
"license": "UNKNOWN",
"namespace": "tableau",
"source": "https://public.tableau.com/app/profile/chris.gerrard/viz/TableauColors/ColorPaletteswithRGBValues"
}
11 changes: 11 additions & 0 deletions tests/test_catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,14 @@ def test_catalog_names() -> None:
assert "viridis" in catalog.unique_keys(categories=("sequential",))
assert "viridis" not in catalog.unique_keys(interpolation="nearest")
assert "viridis" in catalog.unique_keys(interpolation="linear")


@pytest.mark.parametrize("name", ["tab10", "seaborn:tab10", "tableau:tab10"])
def test_tableau_names(name: str, caplog: pytest.LogCaptureFixture) -> None:
# the tableau colormaps used to be (mistakenly) in the seaborn namespace:
# the old names still work, without any ambiguity warning.
# (a fresh catalog: the ambiguity warning is logged on the first load only)
cat = Catalog()
assert cat.resolve(name) == "tableau:tab10"
assert cat[name].qualified_name == "tableau:tab10"
assert not caplog.records
Loading