-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #228 from knaaptime/colors
reimplement rgbas
- Loading branch information
Showing
4 changed files
with
43,135 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,3 +41,4 @@ Utilities | |
mapclassify.Pooled | ||
mapclassify.classify | ||
mapclassify.gadf | ||
mapclassify.util.get_color_array |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,19 @@ | ||
import geopandas | ||
import numpy as np | ||
from mapclassify.util import get_rgba | ||
from numpy.testing import assert_array_equal | ||
from mapclassify.util import get_color_array | ||
|
||
world = geopandas.read_file( | ||
"https://naciscdn.org/naturalearth/110m/cultural/ne_110m_admin_0_countries.zip" | ||
) | ||
|
||
|
||
def test_rgba(): | ||
colors = get_rgba(world.area, cmap="viridis")[0] | ||
assert colors == [ | ||
np.float64(68.08602), | ||
np.float64(1.24287), | ||
np.float64(84.000825), | ||
np.float64(255.0), | ||
] | ||
colors = get_color_array(world.area, cmap="viridis")[0] | ||
assert_array_equal(colors, np.array([68, 1, 84, 255])) | ||
|
||
|
||
def test_rgba(): | ||
colors = get_color_array(world.area, cmap="viridis", as_hex=True)[0] | ||
assert_array_equal(colors,'#440154') | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.