윤영준 윤영준 2023-06-14
fixed a bug
@10f7df9a8540773b14b8d92e63ea4f4bced3a1d4
choropleth.py
--- choropleth.py
+++ choropleth.py
@@ -187,11 +187,7 @@
 
     # fig.show()  # debug
     if save:
-        # 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"{save_dir}"
-        cv2.imwrite(p, cv2.cvtColor(img, cv2.COLOR_RGB2BGR))
+        # because plotly does not have any methods to adjust geojson object.
         fig.update_layout(
             title=dict(
                 yanchor="top",
@@ -202,6 +198,12 @@
                 font_color="Black"
             ),
         )
+        # 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"{save_dir}"
+        cv2.imwrite(p, cv2.cvtColor(img, cv2.COLOR_RGB2BGR))
+
         print(f"saved at : {p}")
     else:
         return fig
Add a comment
List