newsworthycharts 1.65.1__py3-none-any.whl → 1.65.3__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.
- newsworthycharts/__init__.py +1 -1
- newsworthycharts/chart.py +17 -11
- newsworthycharts/rc/newsworthy +1 -2
- {newsworthycharts-1.65.1.dist-info → newsworthycharts-1.65.3.dist-info}/METADATA +25 -16
- {newsworthycharts-1.65.1.dist-info → newsworthycharts-1.65.3.dist-info}/RECORD +8 -12
- {newsworthycharts-1.65.1.dist-info → newsworthycharts-1.65.3.dist-info}/WHEEL +1 -1
- {newsworthycharts-1.65.1.dist-info → newsworthycharts-1.65.3.dist-info}/top_level.txt +0 -0
- newsworthycharts/custom/pts.py +0 -8
- newsworthycharts/custom/temperature.py +0 -20
- newsworthycharts/translations/.~lock.datawrapper_regions.csv# +0 -1
- newsworthycharts/translations/.~lock.se_municipalities.csv# +0 -1
- {newsworthycharts-1.65.1.dist-info → newsworthycharts-1.65.3.dist-info}/LICENSE.txt +0 -0
newsworthycharts/__init__.py
CHANGED
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
|
@@ -633,8 +636,10 @@ class Chart(object):
|
|
633
636
|
|
634
637
|
# Fit area below chart
|
635
638
|
try:
|
636
|
-
tick_label_height = max(
|
637
|
-
|
639
|
+
tick_label_height = max(
|
640
|
+
[self._text_rel_height(lbl)
|
641
|
+
for lbl in self.ax.get_xticklabels()]
|
642
|
+
)
|
638
643
|
except ValueError:
|
639
644
|
# handle charts without ticks
|
640
645
|
tick_label_height = 0
|
@@ -643,7 +648,7 @@ class Chart(object):
|
|
643
648
|
# ticks labels
|
644
649
|
tick_label_height
|
645
650
|
# some padding
|
646
|
-
+ 30 / self._h
|
651
|
+
# + 30 / self._h
|
647
652
|
# chart notes (if any)
|
648
653
|
+ self._note_rel_height
|
649
654
|
# chart caption and logo (if any)
|
@@ -842,7 +847,7 @@ class Chart(object):
|
|
842
847
|
if self._title_elem:
|
843
848
|
rel_height += self._text_rel_height(self._title_elem)
|
844
849
|
# Adds a fixed margin below
|
845
|
-
rel_height +=
|
850
|
+
rel_height += 0.008
|
846
851
|
return rel_height
|
847
852
|
|
848
853
|
@property
|
@@ -851,7 +856,8 @@ class Chart(object):
|
|
851
856
|
if self._subtitle_elem:
|
852
857
|
rel_height += self._text_rel_height(self._subtitle_elem)
|
853
858
|
# Adds a fixed margin below
|
854
|
-
rel_height +=
|
859
|
+
rel_height += 0.008
|
860
|
+
# rel_height += 15 / self._h
|
855
861
|
return rel_height
|
856
862
|
|
857
863
|
@property
|
newsworthycharts/rc/newsworthy
CHANGED
@@ -6,7 +6,7 @@ backend : Agg
|
|
6
6
|
figure.dpi : 150
|
7
7
|
|
8
8
|
# Margins
|
9
|
-
savefig.pad_inches
|
9
|
+
savefig.pad_inches : 0.2
|
10
10
|
legend.borderaxespad : 0.7 # the margin between legend box and axes
|
11
11
|
|
12
12
|
# Axes and ticks
|
@@ -65,4 +65,3 @@ lines.markersize : 8
|
|
65
65
|
# Fill between lines
|
66
66
|
#! fill_between_color : F7F4F4
|
67
67
|
#! fill_between_alpha : 0.5
|
68
|
-
|
@@ -1,29 +1,29 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: newsworthycharts
|
3
|
-
Version: 1.65.
|
3
|
+
Version: 1.65.3
|
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.
|
6
|
+
Download-URL: https://github.com/jplusplus/newsworthycharts/archive/1.65.3.tar.gz
|
7
7
|
Author: Jens Finnäs and Leo Wallentin, J++ Stockholm
|
8
8
|
Author-email: stockholm@jplusplus.org
|
9
9
|
License: MIT
|
10
10
|
Requires-Python: >=3.9
|
11
11
|
Description-Content-Type: text/x-rst
|
12
12
|
License-File: LICENSE.txt
|
13
|
-
Requires-Dist: boto3>=1.26
|
14
|
-
Requires-Dist: matplotlib==3.9.2
|
15
|
-
Requires-Dist: langcodes>=3.3
|
16
|
-
Requires-Dist: Babel<3,>=2.14.0
|
17
|
-
Requires-Dist: PyYAML>=3
|
18
|
-
Requires-Dist: adjustText==0.7.3
|
19
|
-
Requires-Dist: numpy>2
|
20
|
-
Requires-Dist: python-dateutil<3,>=2
|
21
|
-
Requires-Dist: Pillow==11.0.0
|
22
|
-
Requires-Dist: requests>=2.22
|
23
|
-
Requires-Dist: matplotlib-label-lines==0.5.1
|
24
|
-
Requires-Dist: geopandas>=1
|
25
|
-
Requires-Dist: mapclassify==2.8.1
|
26
|
-
Requires-Dist: puremagic>=1
|
13
|
+
Requires-Dist: boto3 >=1.26
|
14
|
+
Requires-Dist: matplotlib ==3.9.2
|
15
|
+
Requires-Dist: langcodes >=3.3
|
16
|
+
Requires-Dist: Babel <3,>=2.14.0
|
17
|
+
Requires-Dist: PyYAML >=3
|
18
|
+
Requires-Dist: adjustText ==0.7.3
|
19
|
+
Requires-Dist: numpy >2
|
20
|
+
Requires-Dist: python-dateutil <3,>=2
|
21
|
+
Requires-Dist: Pillow ==11.0.0
|
22
|
+
Requires-Dist: requests >=2.22
|
23
|
+
Requires-Dist: matplotlib-label-lines ==0.5.1
|
24
|
+
Requires-Dist: geopandas >=1
|
25
|
+
Requires-Dist: mapclassify ==2.8.1
|
26
|
+
Requires-Dist: puremagic >=1
|
27
27
|
|
28
28
|
This module contains methods for producing graphs and publishing them on Amazon S3, or in the location of your choice.
|
29
29
|
|
@@ -259,6 +259,15 @@ Roadmap
|
|
259
259
|
Changelog
|
260
260
|
---------
|
261
261
|
|
262
|
+
- 1.65.3
|
263
|
+
|
264
|
+
- Dynamic title font size adjustments
|
265
|
+
- Further title margin adjustments
|
266
|
+
|
267
|
+
- 1.65.2
|
268
|
+
|
269
|
+
- Title margin adjustments
|
270
|
+
|
262
271
|
- 1.65.1
|
263
272
|
|
264
273
|
- Fixed legend bug in ProgressChart
|
@@ -1,7 +1,7 @@
|
|
1
|
-
newsworthycharts/__init__.py,sha256=
|
1
|
+
newsworthycharts/__init__.py,sha256=ODCtHqJexpBEQZZc3IXGci1BSm9InC4RbbjH4T0gNgo,1160
|
2
2
|
newsworthycharts/bubblemap.py,sha256=nkocWmpiFgfjEuJGAsthjY5X7Q56jXWsZHUGXw4PwgE,2587
|
3
3
|
newsworthycharts/categoricalchart.py,sha256=wLrS8H69Sx3FT-0r3w3ZOIC83IHb8HCHD0zTsXiIiNA,15737
|
4
|
-
newsworthycharts/chart.py,sha256=
|
4
|
+
newsworthycharts/chart.py,sha256=uXMjIM33DHpHSabQcodc-wniKJ0AaSTrtY9UavC8EUU,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
|
@@ -13,8 +13,6 @@ newsworthycharts/storage.py,sha256=myERhlpvXyExXxUByBq9eW1bWkCyfH9SwTZbsWSyy3Q,4
|
|
13
13
|
newsworthycharts/stripechart.py,sha256=9B6PX2MyLuKNQ8W0OGdKbP0-U32kju0K_NHHwwz_J68,1547
|
14
14
|
newsworthycharts/custom/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
15
15
|
newsworthycharts/custom/climate_cars.py,sha256=WyNLgjgRCv_zRrzVuk_BmcigFSzpzudjEAYmdvdBe8I,9407
|
16
|
-
newsworthycharts/custom/pts.py,sha256=B_7y0rwvUMSlGoGopqlaS9RipjRrQ7cc4NXmQV_U31E,220
|
17
|
-
newsworthycharts/custom/temperature.py,sha256=8WE5xXTzP1zLc655ltqdE7ypl2pguC6kX9HG_paW4BE,679
|
18
16
|
newsworthycharts/lib/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
19
17
|
newsworthycharts/lib/color_fn.py,sha256=ck65GzTS9oPgHUCnKDwX2z8zlnNyzncw97MmhXwi8z8,1282
|
20
18
|
newsworthycharts/lib/colors.py,sha256=U04TDkvoMQkcldRFXfnwyLOTwq1SWW2se-Ad-DNcw9o,485
|
@@ -26,14 +24,12 @@ newsworthycharts/lib/mimetypes.py,sha256=bL9HtVWbn2Of39LcBt4u4yelkr4bGZiyebq3OfL
|
|
26
24
|
newsworthycharts/lib/utils.py,sha256=l4SUVB-8lnm3XHqHNo5KgZuZNv_VaFnrH76hrZmDq1s,7231
|
27
25
|
newsworthycharts/maps/se-4.gpkg,sha256=oWw5j7FPVpI0ig67jNDim8qSn5SG8rcHp0014-uTKZM,290816
|
28
26
|
newsworthycharts/maps/se-7.gpkg,sha256=Vmvqudq_ZtgV0sd6TY6kuk7vzqmYZCJmaxtsJ87q2a8,331776
|
29
|
-
newsworthycharts/rc/newsworthy,sha256=
|
30
|
-
newsworthycharts/translations/.~lock.datawrapper_regions.csv#,sha256=lISyvTWrw8LTG01qMC_F5RxDwamXBeq9vJRKKwBYtRg,75
|
31
|
-
newsworthycharts/translations/.~lock.se_municipalities.csv#,sha256=MEff-0d958fdtjBWyt0UnzZWf8OBFx-6PFKeGqGR8NM,80
|
27
|
+
newsworthycharts/rc/newsworthy,sha256=yOIZvYS6PG1u19VMcdtfj9vbihKQsey5IprwqK59KgE,1589
|
32
28
|
newsworthycharts/translations/datawrapper_regions.csv,sha256=fzZcQRX6RFMlNNP8mpgfYNdR3Y0QAlQxDXk8FXTaWWI,9214
|
33
29
|
newsworthycharts/translations/regions.py,sha256=Nv1McQjggD4S3JRu82rDMTG3pqUVR13E5-FBpSYbm98,239
|
34
30
|
newsworthycharts/translations/se_municipalities.csv,sha256=br_mm-IvzQtj_W55_ATREhJ97jWnCweBFlDAVY2EBxA,7098
|
35
|
-
newsworthycharts-1.65.
|
36
|
-
newsworthycharts-1.65.
|
37
|
-
newsworthycharts-1.65.
|
38
|
-
newsworthycharts-1.65.
|
39
|
-
newsworthycharts-1.65.
|
31
|
+
newsworthycharts-1.65.3.dist-info/LICENSE.txt,sha256=Sq6kGICrehbhC_FolNdXf0djKjTpv3YqjFCIYsxdQN4,1069
|
32
|
+
newsworthycharts-1.65.3.dist-info/METADATA,sha256=4dOLUm5Cvev74zXZek-hHMdY2aZQLt6tQoUjvJACEmo,30850
|
33
|
+
newsworthycharts-1.65.3.dist-info/WHEEL,sha256=cVxcB9AmuTcXqmwrtPhNK88dr7IR_b6qagTj0UvIEbY,91
|
34
|
+
newsworthycharts-1.65.3.dist-info/top_level.txt,sha256=dn_kzIj8UgUCMsh1PHdVEQJHVGSsN7Z8YJF-8xXa8n0,17
|
35
|
+
newsworthycharts-1.65.3.dist-info/RECORD,,
|
File without changes
|
newsworthycharts/custom/pts.py
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
from newsworthycharts import SerialChart
|
2
|
-
import numpy as np
|
3
|
-
|
4
|
-
class TemperatueChart(SerialChart):
|
5
|
-
def _add_data(self):
|
6
|
-
self.color_fn = "positive_negative"
|
7
|
-
if len(self.data) != 1:
|
8
|
-
raise ValueError("TemperatueChart takes one and only one data series.")
|
9
|
-
|
10
|
-
dates = [x[0] for x in self.data[0]]
|
11
|
-
values = [x[1] for x in self.data[0]]
|
12
|
-
s = np.array(values, dtype=np.float)
|
13
|
-
mean = np.nanmean(s)
|
14
|
-
vs_mean = s - mean
|
15
|
-
self.data[0] = list(zip(dates, vs_mean.tolist()))
|
16
|
-
self._ymin = np.nanmin(vs_mean)
|
17
|
-
self.data.max_val = np.nanmax(vs_mean)
|
18
|
-
|
19
|
-
|
20
|
-
super(TemperatueChart, self)._add_data()
|
@@ -1 +0,0 @@
|
|
1
|
-
,jens,jens-XPS-13,10.02.2020 11:26,file:///home/jens/.config/libreoffice/4;
|
@@ -1 +0,0 @@
|
|
1
|
-
,jens,jens-XPS-13-9310,20.03.2023 13:52,file:///home/jens/.config/libreoffice/4;
|
File without changes
|