|
| 1 | +# -*- coding: utf-8 -*- |
| 2 | +"""" |
| 3 | +Folium Colormap Module |
| 4 | +---------------------- |
| 5 | +""" |
| 6 | +import folium.colormap as cm |
| 7 | + |
| 8 | +def test_simple_step(): |
| 9 | + step = cm.StepColormap(['green','yellow','red'], vmin=3., vmax=10., index=[3,4,8,10], caption='step') |
| 10 | + step = cm.StepColormap(['r','y','g','c','b','m']) |
| 11 | + step._repr_html_() |
| 12 | + |
| 13 | +def test_simple_linear(): |
| 14 | + linear = cm.LinearColormap(['green','yellow','red'], vmin=3., vmax=10.) |
| 15 | + linear = cm.LinearColormap(['red','orange', 'yellow','green'], index=[0,0.1,0.9,1.]) |
| 16 | + linear._repr_html_() |
| 17 | + |
| 18 | +def test_linear_to_step(): |
| 19 | + some_list = [30.6, 50, 51, 52, 53, 54, 55, 60, 70, 100] |
| 20 | + lc = cm.linear.YlOrRd |
| 21 | + lc.to_step(n=12) |
| 22 | + lc.to_step(index=[0,2,4,6,8,10]) |
| 23 | + lc.to_step(data=some_list, n=12) |
| 24 | + lc.to_step(data=some_list, n=12, method='linear') |
| 25 | + lc.to_step(data=some_list, n=12, method='log') |
| 26 | + lc.to_step(data=some_list, n=30, method='quantiles') |
| 27 | + lc.to_step(data=some_list, quantiles=[0,0.3,0.7,1]) |
| 28 | + lc.to_step(data=some_list, quantiles=[0,0.3,0.7,1], round_method='int') |
| 29 | + lc.to_step(data=some_list, quantiles=[0,0.3,0.7,1], round_method='log10') |
| 30 | + |
| 31 | +def test_step_to_linear(): |
| 32 | + step = cm.StepColormap(['green','yellow','red'], vmin=3., vmax=10., index=[3,4,8,10], caption='step') |
| 33 | + step.to_linear() |
| 34 | + |
| 35 | +def test_linear_object(): |
| 36 | + cm.linear.OrRd._repr_html_() |
| 37 | + cm.linear.PuBu.to_step(12) |
| 38 | + cm.linear.YlGn.scale(3,12) |
| 39 | + cm.linear._repr_html_() |
0 commit comments