Spaces:
Sleeping
Sleeping
cassiebuhler
commited on
Commit
·
690fe2e
1
Parent(s):
46bc3f8
fixed color
Browse files
app.py
CHANGED
@@ -69,7 +69,7 @@ url_states = "https://huggingface.co/datasets/boettiger-lab/landvote/resolve/mai
|
|
69 |
|
70 |
|
71 |
dark_orange = 'rgba(171, 86, 1, 1)' # dark orange - min value
|
72 |
-
light_orange = 'rgba(
|
73 |
grey = 'rgba(211, 211, 211, 1)' # grey
|
74 |
light_green = 'rgba(195, 219, 195, 1)' # light green
|
75 |
dark_green = 'rgba(65, 125, 65, 1)' # dark green - max value
|
@@ -89,17 +89,28 @@ style = {
|
|
89 |
],
|
90 |
"paint": {
|
91 |
"fill-extrusion-color": [
|
92 |
-
|
93 |
-
|
|
|
94 |
[
|
95 |
-
|
96 |
-
|
|
|
|
|
|
|
|
|
97 |
],
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
103 |
],
|
104 |
"fill-extrusion-height": ["*", ["get", "log_amount"], 5000],
|
105 |
}
|
@@ -121,17 +132,28 @@ style_states = {
|
|
121 |
],
|
122 |
"paint": {
|
123 |
"fill-color": [
|
124 |
-
|
125 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
126 |
[
|
127 |
-
|
128 |
-
|
|
|
|
|
|
|
|
|
129 |
],
|
130 |
-
|
131 |
-
45, light_orange,
|
132 |
-
50, grey,
|
133 |
-
55, light_green,
|
134 |
-
85, dark_green,
|
135 |
]
|
136 |
}
|
137 |
},
|
@@ -139,8 +161,6 @@ style_states = {
|
|
139 |
}
|
140 |
|
141 |
|
142 |
-
|
143 |
-
|
144 |
#states are 2D and transparent, thus added separately.
|
145 |
m.add_pmtiles(
|
146 |
url_states,
|
|
|
69 |
|
70 |
|
71 |
dark_orange = 'rgba(171, 86, 1, 1)' # dark orange - min value
|
72 |
+
light_orange = 'rgba(243, 211, 177, 1)' # light orange
|
73 |
grey = 'rgba(211, 211, 211, 1)' # grey
|
74 |
light_green = 'rgba(195, 219, 195, 1)' # light green
|
75 |
dark_green = 'rgba(65, 125, 65, 1)' # dark green - max value
|
|
|
89 |
],
|
90 |
"paint": {
|
91 |
"fill-extrusion-color": [
|
92 |
+
"case",
|
93 |
+
# if passed, color green
|
94 |
+
["==", ["get", "Status"], "Pass"],
|
95 |
[
|
96 |
+
"interpolate", ["linear"], [
|
97 |
+
"to-number", ["slice", ["get", "yes"], 0, -1] # convert 'yes' string to number
|
98 |
+
],
|
99 |
+
50, grey,
|
100 |
+
55, light_green, # higher yes % -> darker green
|
101 |
+
100, dark_green # 100 is the max of data
|
102 |
],
|
103 |
+
# if failed, color orange
|
104 |
+
["==", ["get", "Status"], "Fail"],
|
105 |
+
[
|
106 |
+
"interpolate", ["linear"], [
|
107 |
+
"to-number", ["slice", ["get", "yes"], 0, -1] # convert 'yes' string to number
|
108 |
+
],
|
109 |
+
0, dark_orange, # higher yes % -> lighter orange
|
110 |
+
50, light_orange,
|
111 |
+
67, grey # 67 is the max of data.
|
112 |
+
],
|
113 |
+
grey # if no match
|
114 |
],
|
115 |
"fill-extrusion-height": ["*", ["get", "log_amount"], 5000],
|
116 |
}
|
|
|
132 |
],
|
133 |
"paint": {
|
134 |
"fill-color": [
|
135 |
+
"case",
|
136 |
+
# if passed, color green
|
137 |
+
["==", ["get", "Status"], "Pass"],
|
138 |
+
[
|
139 |
+
"interpolate", ["linear"], [
|
140 |
+
"to-number", ["slice", ["get", "yes"], 0, -1] # convert 'yes' string to number
|
141 |
+
],
|
142 |
+
50, grey,
|
143 |
+
55, light_green, # higher yes % -> darker green
|
144 |
+
100, dark_green # 100 is the max of data
|
145 |
+
],
|
146 |
+
# if failed, color orange
|
147 |
+
["==", ["get", "Status"], "Fail"],
|
148 |
[
|
149 |
+
"interpolate", ["linear"], [
|
150 |
+
"to-number", ["slice", ["get", "yes"], 0, -1] # convert 'yes' string to number
|
151 |
+
],
|
152 |
+
0, dark_orange, # higher yes % -> lighter orange
|
153 |
+
50, light_orange,
|
154 |
+
67, grey # 67 is the max of data.
|
155 |
],
|
156 |
+
grey # if no match
|
|
|
|
|
|
|
|
|
157 |
]
|
158 |
}
|
159 |
},
|
|
|
161 |
}
|
162 |
|
163 |
|
|
|
|
|
164 |
#states are 2D and transparent, thus added separately.
|
165 |
m.add_pmtiles(
|
166 |
url_states,
|