newsworthycharts 1.65.2__py3-none-any.whl → 1.65.4__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- __version__ = "1.65.2"
1
+ __version__ = "1.65.4"
2
2
 
3
3
  from .chart import Chart
4
4
  from .choroplethmap import ChoroplethMap
newsworthycharts/chart.py CHANGED
@@ -91,12 +91,6 @@ class Chart(object):
91
91
  self._language = standardize_tag(language)
92
92
  self._locale = Locale.parse(self._language.replace("-", "_"))
93
93
 
94
- # Dynamic typography
95
- self._title_font = FontProperties()
96
- self._title_font.set_family(self._nwc_style["title_font"])
97
- self._title_font.set_size(self._style["figure.titlesize"])
98
- self._title_font.set_weight(self._style["figure.titleweight"])
99
-
100
94
  self._fig = Figure(layout="tight")
101
95
  FigureCanvas(self._fig)
102
96
  self.ax = self._fig.add_subplot(111)
@@ -112,6 +106,15 @@ class Chart(object):
112
106
  if height:
113
107
  self._h = int(height)
114
108
 
109
+ # Dynamic typography
110
+ self._title_font = FontProperties()
111
+ # scale up slightly < 600px, scale down slightly > 600px
112
+ import math
113
+ adjusted_fontsize = math.log(self._h, 600)
114
+ self._title_font.set_family(self._nwc_style["title_font"])
115
+ self._title_font.set_size(int(adjusted_fontsize * self._style["figure.titlesize"]))
116
+ self._title_font.set_weight(self._style["figure.titleweight"])
117
+
115
118
  # Chart elements. Made available for fitting.
116
119
  self._title_elem = None
117
120
  self._subtitle_elem = None
@@ -844,8 +847,7 @@ class Chart(object):
844
847
  if self._title_elem:
845
848
  rel_height += self._text_rel_height(self._title_elem)
846
849
  # Adds a fixed margin below
847
- rel_height += 0.01
848
- # rel_height += 30 / self._h
850
+ rel_height += 0.008
849
851
  return rel_height
850
852
 
851
853
  @property
@@ -854,7 +856,8 @@ class Chart(object):
854
856
  if self._subtitle_elem:
855
857
  rel_height += self._text_rel_height(self._subtitle_elem)
856
858
  # Adds a fixed margin below
857
- rel_height += 15 / self._h
859
+ rel_height += 0.012
860
+ # rel_height += 15 / self._h
858
861
  return rel_height
859
862
 
860
863
  @property
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: newsworthycharts
3
- Version: 1.65.2
3
+ Version: 1.65.4
4
4
  Summary: Matplotlib wrapper to create charts and publish them on Amazon S3
5
5
  Home-page: https://github.com/jplusplus/newsworthycharts
6
- Download-URL: https://github.com/jplusplus/newsworthycharts/archive/1.65.2.tar.gz
6
+ Download-URL: https://github.com/jplusplus/newsworthycharts/archive/1.65.4.tar.gz
7
7
  Author: Jens Finnäs and Leo Wallentin, J++ Stockholm
8
8
  Author-email: stockholm@jplusplus.org
9
9
  License: MIT
@@ -259,6 +259,15 @@ Roadmap
259
259
  Changelog
260
260
  ---------
261
261
 
262
+ - 1.65.4
263
+
264
+ - Revert some of the title margin changes
265
+
266
+ - 1.65.3
267
+
268
+ - Dynamic title font size adjustments
269
+ - Further title margin adjustments
270
+
262
271
  - 1.65.2
263
272
 
264
273
  - Title margin adjustments
@@ -1,7 +1,7 @@
1
- newsworthycharts/__init__.py,sha256=Ls4rdrPaC7IzvGI5F9AK1YPkSdJwvSZihYFsMKjwCDg,1160
1
+ newsworthycharts/__init__.py,sha256=dpkWjO_q656I2XsRZeAZa5WZ1kihmp5KOSxYFwCbETE,1160
2
2
  newsworthycharts/bubblemap.py,sha256=nkocWmpiFgfjEuJGAsthjY5X7Q56jXWsZHUGXw4PwgE,2587
3
3
  newsworthycharts/categoricalchart.py,sha256=wLrS8H69Sx3FT-0r3w3ZOIC83IHb8HCHD0zTsXiIiNA,15737
4
- newsworthycharts/chart.py,sha256=pAWvd0_-f6NsOYnBZDNl3w5jmzxZSnD-S0S2EuqAMaU,34219
4
+ newsworthycharts/chart.py,sha256=FEQRAvdfX0x3KWFBxFEpGhh3w6dRMX5dTw-VIFPo4jA,34374
5
5
  newsworthycharts/choroplethmap.py,sha256=bCLf4kcchp1C2djg5AxcOM8BdbaMj0xg7UHrZsDafhI,8013
6
6
  newsworthycharts/datawrapper.py,sha256=RRkAVTpfP4updKxUIBaSmKuBi2RUVPaBRF8HDQhlGGA,11250
7
7
  newsworthycharts/map.py,sha256=c409jEO4L8Yr780sJRC0RchR44roAlgOUDAkuk1SfRg,6057
@@ -28,8 +28,8 @@ newsworthycharts/rc/newsworthy,sha256=yOIZvYS6PG1u19VMcdtfj9vbihKQsey5IprwqK59Kg
28
28
  newsworthycharts/translations/datawrapper_regions.csv,sha256=fzZcQRX6RFMlNNP8mpgfYNdR3Y0QAlQxDXk8FXTaWWI,9214
29
29
  newsworthycharts/translations/regions.py,sha256=Nv1McQjggD4S3JRu82rDMTG3pqUVR13E5-FBpSYbm98,239
30
30
  newsworthycharts/translations/se_municipalities.csv,sha256=br_mm-IvzQtj_W55_ATREhJ97jWnCweBFlDAVY2EBxA,7098
31
- newsworthycharts-1.65.2.dist-info/LICENSE.txt,sha256=Sq6kGICrehbhC_FolNdXf0djKjTpv3YqjFCIYsxdQN4,1069
32
- newsworthycharts-1.65.2.dist-info/METADATA,sha256=CUcPOQZOIhoB0qcm0_-LhhPmGeIaLfdwT31PNxwvErw,30762
33
- newsworthycharts-1.65.2.dist-info/WHEEL,sha256=cVxcB9AmuTcXqmwrtPhNK88dr7IR_b6qagTj0UvIEbY,91
34
- newsworthycharts-1.65.2.dist-info/top_level.txt,sha256=dn_kzIj8UgUCMsh1PHdVEQJHVGSsN7Z8YJF-8xXa8n0,17
35
- newsworthycharts-1.65.2.dist-info/RECORD,,
31
+ newsworthycharts-1.65.4.dist-info/LICENSE.txt,sha256=Sq6kGICrehbhC_FolNdXf0djKjTpv3YqjFCIYsxdQN4,1069
32
+ newsworthycharts-1.65.4.dist-info/METADATA,sha256=TfdPxTNdtGU_Rfck2IIlVGWC1CeL7v7ynEZdYkSuvGY,30905
33
+ newsworthycharts-1.65.4.dist-info/WHEEL,sha256=cVxcB9AmuTcXqmwrtPhNK88dr7IR_b6qagTj0UvIEbY,91
34
+ newsworthycharts-1.65.4.dist-info/top_level.txt,sha256=dn_kzIj8UgUCMsh1PHdVEQJHVGSsN7Z8YJF-8xXa8n0,17
35
+ newsworthycharts-1.65.4.dist-info/RECORD,,