
font_names.py is from stack overflow, thus moved to seperate folder with license compliance. DO NOT MIX IT UP.
@5e6bd4e50dd6d4bb050976a59339fe5b2137278c
--- choropleth.py
+++ choropleth.py
... | ... | @@ -194,7 +194,6 @@ |
194 | 194 |
|
195 | 195 |
if show_legend: |
196 | 196 |
if adaptive_legend_font_size: |
197 |
- print("hello") |
|
198 | 197 |
annotation_text_size = np.multiply(lecc_dist, geo_annot_scale) |
199 | 198 |
fig.add_trace( |
200 | 199 |
go.Scattergeo( |
... | ... | @@ -294,7 +293,7 @@ |
294 | 293 |
# slicing static image because there is no way to adjust geojson object there. |
295 | 294 |
img = plotly_fig2array(fig, scale) |
296 | 295 |
img = img[:, 460*scale : 1500*scale] |
297 |
- p = f"figure{sep}{save_dir}.png" |
|
296 |
+ p = f"{save_dir}" |
|
298 | 297 |
cv2.imwrite(p, cv2.cvtColor(img, cv2.COLOR_RGB2BGR)) |
299 | 298 |
fig.update_layout( |
300 | 299 |
title=dict( |
--- example.py
+++ example.py
... | ... | @@ -19,5 +19,5 @@ |
19 | 19 |
|
20 | 20 |
cdf = df.iloc[:,1] |
21 | 21 |
cdf += df.iloc[:,3] |
22 |
-choropleth_chart(shp, cdf, '2022 영천시 1인가구중 중년이상비율', f"1인가구 중년이상", |
|
22 |
+choropleth_chart(shp, cdf, '2022 영천시 1인가구중 중년이상비율', f"output/1인가구 중년이상.png", |
|
23 | 23 |
colorscheme=colorscale[::-1], adaptive_legend_font_size=True)(No newline at end of file) |
--- font_names.py
+++ opensourcecode/font_names.py
... | ... | @@ -1,3 +1,6 @@ |
1 |
+# source : https://stackoverflow.com/questions/75310650/how-to-get-font-path-from-font-name-python |
|
2 |
+# author : Mark Setchell |
|
3 |
+# this code is CC-BY-SA, in other words, do not mix this up with any other code. |
|
1 | 4 |
import matplotlib.font_manager |
2 | 5 |
from PIL import ImageFont |
3 | 6 |
|
Add a comment
Delete comment
Once you delete this comment, you won't be able to recover it. Are you sure you want to delete this comment?