윤영준 윤영준 2023-06-14
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
+++ choropleth.py
@@ -194,7 +194,6 @@
 
     if show_legend:
         if adaptive_legend_font_size:
-            print("hello")
             annotation_text_size = np.multiply(lecc_dist, geo_annot_scale)
             fig.add_trace(
                 go.Scattergeo(
@@ -294,7 +293,7 @@
         # slicing static image because there is no way to adjust geojson object there.
         img = plotly_fig2array(fig, scale)
         img = img[:, 460*scale : 1500*scale]
-        p = f"figure{sep}{save_dir}.png"
+        p = f"{save_dir}"
         cv2.imwrite(p, cv2.cvtColor(img, cv2.COLOR_RGB2BGR))
         fig.update_layout(
             title=dict(
example.py
--- example.py
+++ example.py
@@ -19,5 +19,5 @@
 
 cdf = df.iloc[:,1]
 cdf += df.iloc[:,3]
-choropleth_chart(shp, cdf, '2022 영천시 1인가구중 중년이상비율', f"1인가구 중년이상",
+choropleth_chart(shp, cdf, '2022 영천시 1인가구중 중년이상비율', f"output/1인가구 중년이상.png",
                  colorscheme=colorscale[::-1], adaptive_legend_font_size=True)
(No newline at end of file)
opensourcecode/font_names.py (Renamed from font_names.py)
--- font_names.py
+++ opensourcecode/font_names.py
@@ -1,3 +1,6 @@
+# source : https://stackoverflow.com/questions/75310650/how-to-get-font-path-from-font-name-python
+# author : Mark Setchell
+# this code is CC-BY-SA, in other words, do not mix this up with any other code.
 import matplotlib.font_manager
 from PIL import ImageFont
 
Add a comment
List