newsworthycharts 1.57.2__py3-none-any.whl → 1.58.0__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 +1 -1
- newsworthycharts/map.py +7 -2
- newsworthycharts/serialchart.py +15 -0
- {newsworthycharts-1.57.2.dist-info → newsworthycharts-1.58.0.dist-info}/METADATA +22 -6
- {newsworthycharts-1.57.2.dist-info → newsworthycharts-1.58.0.dist-info}/RECORD +9 -9
- {newsworthycharts-1.57.2.dist-info → newsworthycharts-1.58.0.dist-info}/LICENSE.txt +0 -0
- {newsworthycharts-1.57.2.dist-info → newsworthycharts-1.58.0.dist-info}/WHEEL +0 -0
- {newsworthycharts-1.57.2.dist-info → newsworthycharts-1.58.0.dist-info}/top_level.txt +0 -0
newsworthycharts/__init__.py
CHANGED
newsworthycharts/chart.py
CHANGED
@@ -273,7 +273,7 @@ class Chart(object):
|
|
273
273
|
def _add_title(self, title_text):
|
274
274
|
"""Add a title."""
|
275
275
|
# y=1 wraps title heavily, hence .9999
|
276
|
-
text = self._fig.suptitle(title_text, wrap=True, x=0, y=0.
|
276
|
+
text = self._fig.suptitle(title_text, wrap=True, x=0, y=0.985,
|
277
277
|
horizontalalignment="left",
|
278
278
|
multialignment="left",
|
279
279
|
fontproperties=self._title_font)
|
newsworthycharts/map.py
CHANGED
@@ -99,7 +99,12 @@ class Map(Chart):
|
|
99
99
|
def _normalize_region_code(self, code):
|
100
100
|
code = code.upper().replace("_", "-")
|
101
101
|
# Apply translation, if we find and applicable one
|
102
|
-
|
102
|
+
|
103
|
+
# normalize basemap name, so that `se|03-7` is treated as `se-7
|
104
|
+
# region_translation = REGION_TRANSLATIONS.get(self.base_map, {})
|
105
|
+
_base_map, _subdivisions, _subset, *opts = self.parse_basemap()
|
106
|
+
region_translation = REGION_TRANSLATIONS.get(f"{_base_map}-{_subdivisions}", {})
|
107
|
+
|
103
108
|
region_translation = {k.upper(): v for k, v in region_translation.items()}
|
104
109
|
code = region_translation.get(code, code)
|
105
110
|
return code
|
@@ -132,7 +137,7 @@ class Map(Chart):
|
|
132
137
|
if len(_) > 1:
|
133
138
|
[base_map, subset] = _
|
134
139
|
|
135
|
-
if
|
140
|
+
if self.df is None:
|
136
141
|
__dir = pathlib.Path(__file__).parent.resolve()
|
137
142
|
try:
|
138
143
|
self.df = gpd.read_file(f"{__dir}/maps/{base_map}-{subdivisions}.gpkg")
|
newsworthycharts/serialchart.py
CHANGED
@@ -53,6 +53,7 @@ class SerialChart(Chart):
|
|
53
53
|
|
54
54
|
# Optional: Adds background color to part of charts
|
55
55
|
self.highlighted_x_ranges = []
|
56
|
+
self.x_range_labels = []
|
56
57
|
|
57
58
|
@property
|
58
59
|
def ymin(self):
|
@@ -443,6 +444,20 @@ class SerialChart(Chart):
|
|
443
444
|
x0 = to_date(x0)
|
444
445
|
x1 = to_date(x1)
|
445
446
|
self.ax.axvspan(x0, x1, alpha=.4, color="lightgrey", lw=0)
|
447
|
+
for idx, t in enumerate(self.x_range_labels):
|
448
|
+
if idx >= len(self.highlighted_x_ranges):
|
449
|
+
continue
|
450
|
+
(x0, x1) = self.highlighted_x_ranges[idx]
|
451
|
+
x0 = to_date(x0)
|
452
|
+
x1 = to_date(x1)
|
453
|
+
_y = self.ymax or self.data.max_val + self.baseline
|
454
|
+
self.ax.text(
|
455
|
+
x0 + (x1 - x0) / 2,
|
456
|
+
_y,
|
457
|
+
t,
|
458
|
+
ha='center',
|
459
|
+
color=self._nwc_style["dark_gray_color"],
|
460
|
+
)
|
446
461
|
|
447
462
|
# Accentuate y=0 || y=baseline
|
448
463
|
# if (self.data.min_val < self.baseline) or self.baseline_annotation:
|
@@ -1,9 +1,9 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: newsworthycharts
|
3
|
-
Version: 1.
|
3
|
+
Version: 1.58.0
|
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.
|
6
|
+
Download-URL: https://github.com/jplusplus/newsworthycharts/archive/1.58.0.tar.gz
|
7
7
|
Author: Jens Finnäs and Leo Wallentin, J++ Stockholm
|
8
8
|
Author-email: stockholm@jplusplus.org
|
9
9
|
License: MIT
|
@@ -15,11 +15,11 @@ Requires-Dist: Pillow ==10.3.0
|
|
15
15
|
Requires-Dist: PyYAML >=3
|
16
16
|
Requires-Dist: adjustText ==0.7.3
|
17
17
|
Requires-Dist: boto3 >=1.26
|
18
|
-
Requires-Dist: geopandas ==0.14.
|
18
|
+
Requires-Dist: geopandas ==0.14.4
|
19
19
|
Requires-Dist: langcodes >=3.3
|
20
20
|
Requires-Dist: mapclassify ==2.6.1
|
21
21
|
Requires-Dist: matplotlib-label-lines ==0.5.1
|
22
|
-
Requires-Dist: matplotlib ==3.
|
22
|
+
Requires-Dist: matplotlib ==3.9.0
|
23
23
|
Requires-Dist: numpy <2,>=1.21.0
|
24
24
|
Requires-Dist: python-dateutil <3,>=2
|
25
25
|
Requires-Dist: requests >=2.22
|
@@ -164,6 +164,7 @@ These settings are available for all chart types:
|
|
164
164
|
- colors = None # A list of colors, each correspoding to one dataseries. Default behaviour is to use the style colors
|
165
165
|
- value_labels = False # Print out values at points on line?
|
166
166
|
- highlighted_x_ranges = [] # List of tuples with start and end of highlighted areas
|
167
|
+
- x_range_labels = [] # List of labels for highlighted areas
|
167
168
|
- label_placement = "legend" # legend|inline|outside
|
168
169
|
- color_labels = None # A dictionary of label/color, to override style colors
|
169
170
|
|
@@ -193,8 +194,13 @@ These settings are available for all chart types:
|
|
193
194
|
- base_map = None
|
194
195
|
- missing_label = None # Add a label for no data
|
195
196
|
|
197
|
+
`basemap` can be `{ISO}-{level}` or `{ISO}|{subset}-{level}`.
|
198
|
+
For example, `se-4` will show Swedish counties, while `se|03-7` will show municipalities (`se-7`) starting with `03`.
|
199
|
+
|
196
200
|
**ChoroplethMap**
|
197
201
|
|
202
|
+
_ Inherits from Map _
|
203
|
+
|
198
204
|
**ProgressChart**
|
199
205
|
|
200
206
|
**RangePlot**
|
@@ -233,13 +239,23 @@ Roadmap
|
|
233
239
|
- Getting rid of custom settings-hack
|
234
240
|
- Custom month locator with equal-width month bars
|
235
241
|
|
236
|
-
|
237
242
|
Changelog
|
238
243
|
---------
|
239
244
|
|
245
|
+
- 1.58.0
|
246
|
+
|
247
|
+
- Matplotlib==3.9
|
248
|
+
- Added `.x_range_labels` to SerialChart
|
249
|
+
- Some tweaks to title placement to avoid cropping of diactritics
|
250
|
+
|
251
|
+
- 1.57.3
|
252
|
+
|
253
|
+
- Make NW region keys work with map subsets (e.g. `SE|03-7`)
|
254
|
+
- Don't crash on subsequent calls to basemap parser
|
255
|
+
|
240
256
|
- 1.57.2
|
241
257
|
|
242
|
-
- reduce excessive padding in
|
258
|
+
- reduce excessive padding in categorical vertical charts
|
243
259
|
- improved padding and margin logic for titles/subtitles (taking line spacing into account)
|
244
260
|
|
245
261
|
- 1.57.1
|
@@ -1,14 +1,14 @@
|
|
1
|
-
newsworthycharts/__init__.py,sha256=
|
1
|
+
newsworthycharts/__init__.py,sha256=TGm5s8DIgvd8xNLCVN0tjDhFXlDUgdQnIWchaonBmaw,1160
|
2
2
|
newsworthycharts/bubblemap.py,sha256=nkocWmpiFgfjEuJGAsthjY5X7Q56jXWsZHUGXw4PwgE,2587
|
3
3
|
newsworthycharts/categoricalchart.py,sha256=LwOZ3VbNy9vzvoK0s77AkbfMt4CXVDSAhnsnBInUIrE,14764
|
4
|
-
newsworthycharts/chart.py,sha256=
|
4
|
+
newsworthycharts/chart.py,sha256=B1T_gvtKB3ogWnzQCnPsUgerBm6ThY5d6DA8acnlUr4,30634
|
5
5
|
newsworthycharts/choroplethmap.py,sha256=2b61MuYed8ccc7uZkzuSdZDbqVR7C3OP1ftb_khuaLw,6069
|
6
6
|
newsworthycharts/datawrapper.py,sha256=RRkAVTpfP4updKxUIBaSmKuBi2RUVPaBRF8HDQhlGGA,11250
|
7
|
-
newsworthycharts/map.py,sha256=
|
7
|
+
newsworthycharts/map.py,sha256=ruhFEFmGg8DwySDPnEbx_4n57DgHL5LlLKQEnoNmuIU,6225
|
8
8
|
newsworthycharts/rangeplot.py,sha256=NE1W9TnmlpK6T3RvBJOU3nd73EXqkj17OY9i5zlw_cQ,8366
|
9
9
|
newsworthycharts/scatterplot.py,sha256=6iaMoiZx__Gc-2Hcdw-8Ga5dSonrFo3oexKNmSFuir4,4959
|
10
10
|
newsworthycharts/seasonalchart.py,sha256=rr55yqJUkaYDR9Ik98jes6574oY1U8t8LwoLE3gClW4,1967
|
11
|
-
newsworthycharts/serialchart.py,sha256=
|
11
|
+
newsworthycharts/serialchart.py,sha256=MGP-yCwfKpR_duPnX1_9A1mENOGSeoqq8iI-8GLiNFk,26232
|
12
12
|
newsworthycharts/storage.py,sha256=myERhlpvXyExXxUByBq9eW1bWkCyfH9SwTZbsWSyy3Q,4301
|
13
13
|
newsworthycharts/stripechart.py,sha256=9B6PX2MyLuKNQ8W0OGdKbP0-U32kju0K_NHHwwz_J68,1547
|
14
14
|
newsworthycharts/custom/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -28,8 +28,8 @@ newsworthycharts/rc/newsworthy,sha256=X0btLNrmk2DRrfOsKj_WCSIgeD6btacEN2tRF_B4m8
|
|
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.
|
32
|
-
newsworthycharts-1.
|
33
|
-
newsworthycharts-1.
|
34
|
-
newsworthycharts-1.
|
35
|
-
newsworthycharts-1.
|
31
|
+
newsworthycharts-1.58.0.dist-info/LICENSE.txt,sha256=Sq6kGICrehbhC_FolNdXf0djKjTpv3YqjFCIYsxdQN4,1069
|
32
|
+
newsworthycharts-1.58.0.dist-info/METADATA,sha256=1aPmXJsf0vzxQTnv3x8RYYB5li-6mOZpb30iruMP-X4,27063
|
33
|
+
newsworthycharts-1.58.0.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
|
34
|
+
newsworthycharts-1.58.0.dist-info/top_level.txt,sha256=dn_kzIj8UgUCMsh1PHdVEQJHVGSsN7Z8YJF-8xXa8n0,17
|
35
|
+
newsworthycharts-1.58.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|