newsworthycharts 1.57.2__tar.gz → 1.58.0__tar.gz
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-1.57.2 → newsworthycharts-1.58.0}/PKG-INFO +20 -4
- newsworthycharts-1.57.2/newsworthycharts.egg-info/PKG-INFO → newsworthycharts-1.58.0/README.rst +18 -15
- {newsworthycharts-1.57.2 → newsworthycharts-1.58.0}/newsworthycharts/__init__.py +1 -1
- {newsworthycharts-1.57.2 → newsworthycharts-1.58.0}/newsworthycharts/chart.py +1 -1
- {newsworthycharts-1.57.2 → newsworthycharts-1.58.0}/newsworthycharts/map.py +7 -2
- {newsworthycharts-1.57.2 → newsworthycharts-1.58.0}/newsworthycharts/serialchart.py +15 -0
- newsworthycharts-1.57.2/README.rst → newsworthycharts-1.58.0/newsworthycharts.egg-info/PKG-INFO +31 -2
- {newsworthycharts-1.57.2 → newsworthycharts-1.58.0}/newsworthycharts.egg-info/requires.txt +2 -2
- {newsworthycharts-1.57.2 → newsworthycharts-1.58.0}/setup.py +2 -2
- {newsworthycharts-1.57.2 → newsworthycharts-1.58.0}/test/test_choropleth_maps.py +22 -1
- {newsworthycharts-1.57.2 → newsworthycharts-1.58.0}/LICENSE.txt +0 -0
- {newsworthycharts-1.57.2 → newsworthycharts-1.58.0}/MANIFEST.in +0 -0
- {newsworthycharts-1.57.2 → newsworthycharts-1.58.0}/newsworthycharts/bubblemap.py +0 -0
- {newsworthycharts-1.57.2 → newsworthycharts-1.58.0}/newsworthycharts/categoricalchart.py +0 -0
- {newsworthycharts-1.57.2 → newsworthycharts-1.58.0}/newsworthycharts/choroplethmap.py +0 -0
- {newsworthycharts-1.57.2 → newsworthycharts-1.58.0}/newsworthycharts/custom/__init__.py +0 -0
- {newsworthycharts-1.57.2 → newsworthycharts-1.58.0}/newsworthycharts/custom/climate_cars.py +0 -0
- {newsworthycharts-1.57.2 → newsworthycharts-1.58.0}/newsworthycharts/datawrapper.py +0 -0
- {newsworthycharts-1.57.2 → newsworthycharts-1.58.0}/newsworthycharts/lib/__init__.py +0 -0
- {newsworthycharts-1.57.2 → newsworthycharts-1.58.0}/newsworthycharts/lib/color_fn.py +0 -0
- {newsworthycharts-1.57.2 → newsworthycharts-1.58.0}/newsworthycharts/lib/colors.py +0 -0
- {newsworthycharts-1.57.2 → newsworthycharts-1.58.0}/newsworthycharts/lib/datalist.py +0 -0
- {newsworthycharts-1.57.2 → newsworthycharts-1.58.0}/newsworthycharts/lib/formatter.py +0 -0
- {newsworthycharts-1.57.2 → newsworthycharts-1.58.0}/newsworthycharts/lib/geography.py +0 -0
- {newsworthycharts-1.57.2 → newsworthycharts-1.58.0}/newsworthycharts/lib/locator.py +0 -0
- {newsworthycharts-1.57.2 → newsworthycharts-1.58.0}/newsworthycharts/lib/mimetypes.py +0 -0
- {newsworthycharts-1.57.2 → newsworthycharts-1.58.0}/newsworthycharts/lib/utils.py +0 -0
- {newsworthycharts-1.57.2 → newsworthycharts-1.58.0}/newsworthycharts/maps/se-4.gpkg +0 -0
- {newsworthycharts-1.57.2 → newsworthycharts-1.58.0}/newsworthycharts/maps/se-7.gpkg +0 -0
- {newsworthycharts-1.57.2 → newsworthycharts-1.58.0}/newsworthycharts/rangeplot.py +0 -0
- {newsworthycharts-1.57.2 → newsworthycharts-1.58.0}/newsworthycharts/rc/newsworthy +0 -0
- {newsworthycharts-1.57.2 → newsworthycharts-1.58.0}/newsworthycharts/scatterplot.py +0 -0
- {newsworthycharts-1.57.2 → newsworthycharts-1.58.0}/newsworthycharts/seasonalchart.py +0 -0
- {newsworthycharts-1.57.2 → newsworthycharts-1.58.0}/newsworthycharts/storage.py +0 -0
- {newsworthycharts-1.57.2 → newsworthycharts-1.58.0}/newsworthycharts/stripechart.py +0 -0
- {newsworthycharts-1.57.2 → newsworthycharts-1.58.0}/newsworthycharts/translations/datawrapper_regions.csv +0 -0
- {newsworthycharts-1.57.2 → newsworthycharts-1.58.0}/newsworthycharts/translations/regions.py +0 -0
- {newsworthycharts-1.57.2 → newsworthycharts-1.58.0}/newsworthycharts/translations/se_municipalities.csv +0 -0
- {newsworthycharts-1.57.2 → newsworthycharts-1.58.0}/newsworthycharts.egg-info/SOURCES.txt +0 -0
- {newsworthycharts-1.57.2 → newsworthycharts-1.58.0}/newsworthycharts.egg-info/dependency_links.txt +0 -0
- {newsworthycharts-1.57.2 → newsworthycharts-1.58.0}/newsworthycharts.egg-info/not-zip-safe +0 -0
- {newsworthycharts-1.57.2 → newsworthycharts-1.58.0}/newsworthycharts.egg-info/top_level.txt +0 -0
- {newsworthycharts-1.57.2 → newsworthycharts-1.58.0}/setup.cfg +0 -0
- {newsworthycharts-1.57.2 → newsworthycharts-1.58.0}/test/test_categorical_chart.py +0 -0
- {newsworthycharts-1.57.2 → newsworthycharts-1.58.0}/test/test_custom_climate_cars.py +0 -0
- {newsworthycharts-1.57.2 → newsworthycharts-1.58.0}/test/test_data_list.py +0 -0
- {newsworthycharts-1.57.2 → newsworthycharts-1.58.0}/test/test_datawrapper.py +0 -0
- {newsworthycharts-1.57.2 → newsworthycharts-1.58.0}/test/test_main.py +0 -0
- {newsworthycharts-1.57.2 → newsworthycharts-1.58.0}/test/test_rangeplot.py +0 -0
- {newsworthycharts-1.57.2 → newsworthycharts-1.58.0}/test/test_scatterplot.py +0 -0
- {newsworthycharts-1.57.2 → newsworthycharts-1.58.0}/test/test_serial_chart.py +0 -0
@@ -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
|
@@ -151,6 +151,7 @@ These settings are available for all chart types:
|
|
151
151
|
- colors = None # A list of colors, each correspoding to one dataseries. Default behaviour is to use the style colors
|
152
152
|
- value_labels = False # Print out values at points on line?
|
153
153
|
- highlighted_x_ranges = [] # List of tuples with start and end of highlighted areas
|
154
|
+
- x_range_labels = [] # List of labels for highlighted areas
|
154
155
|
- label_placement = "legend" # legend|inline|outside
|
155
156
|
- color_labels = None # A dictionary of label/color, to override style colors
|
156
157
|
|
@@ -180,8 +181,13 @@ These settings are available for all chart types:
|
|
180
181
|
- base_map = None
|
181
182
|
- missing_label = None # Add a label for no data
|
182
183
|
|
184
|
+
`basemap` can be `{ISO}-{level}` or `{ISO}|{subset}-{level}`.
|
185
|
+
For example, `se-4` will show Swedish counties, while `se|03-7` will show municipalities (`se-7`) starting with `03`.
|
186
|
+
|
183
187
|
**ChoroplethMap**
|
184
188
|
|
189
|
+
_ Inherits from Map _
|
190
|
+
|
185
191
|
**ProgressChart**
|
186
192
|
|
187
193
|
**RangePlot**
|
@@ -220,13 +226,23 @@ Roadmap
|
|
220
226
|
- Getting rid of custom settings-hack
|
221
227
|
- Custom month locator with equal-width month bars
|
222
228
|
|
223
|
-
|
224
229
|
Changelog
|
225
230
|
---------
|
226
231
|
|
232
|
+
- 1.58.0
|
233
|
+
|
234
|
+
- Matplotlib==3.9
|
235
|
+
- Added `.x_range_labels` to SerialChart
|
236
|
+
- Some tweaks to title placement to avoid cropping of diactritics
|
237
|
+
|
238
|
+
- 1.57.3
|
239
|
+
|
240
|
+
- Make NW region keys work with map subsets (e.g. `SE|03-7`)
|
241
|
+
- Don't crash on subsequent calls to basemap parser
|
242
|
+
|
227
243
|
- 1.57.2
|
228
244
|
|
229
|
-
- reduce excessive padding in
|
245
|
+
- reduce excessive padding in categorical vertical charts
|
230
246
|
- improved padding and margin logic for titles/subtitles (taking line spacing into account)
|
231
247
|
|
232
248
|
- 1.57.1
|
newsworthycharts-1.57.2/newsworthycharts.egg-info/PKG-INFO → newsworthycharts-1.58.0/README.rst
RENAMED
@@ -1,16 +1,3 @@
|
|
1
|
-
Metadata-Version: 2.1
|
2
|
-
Name: newsworthycharts
|
3
|
-
Version: 1.57.2
|
4
|
-
Summary: Matplotlib wrapper to create charts and publish them on Amazon S3
|
5
|
-
Home-page: https://github.com/jplusplus/newsworthycharts
|
6
|
-
Download-URL: https://github.com/jplusplus/newsworthycharts/archive/1.57.2.tar.gz
|
7
|
-
Author: Jens Finnäs and Leo Wallentin, J++ Stockholm
|
8
|
-
Author-email: stockholm@jplusplus.org
|
9
|
-
License: MIT
|
10
|
-
Requires-Python: >=3.9
|
11
|
-
Description-Content-Type: text/x-rst
|
12
|
-
License-File: LICENSE.txt
|
13
|
-
|
14
1
|
This module contains methods for producing graphs and publishing them on Amazon S3, or in the location of your choice.
|
15
2
|
|
16
3
|
It is written and maintained for `Newsworthy <https://www.newsworthy.se/en/>`_, but could possibly come in handy for other people as well.
|
@@ -151,6 +138,7 @@ These settings are available for all chart types:
|
|
151
138
|
- colors = None # A list of colors, each correspoding to one dataseries. Default behaviour is to use the style colors
|
152
139
|
- value_labels = False # Print out values at points on line?
|
153
140
|
- highlighted_x_ranges = [] # List of tuples with start and end of highlighted areas
|
141
|
+
- x_range_labels = [] # List of labels for highlighted areas
|
154
142
|
- label_placement = "legend" # legend|inline|outside
|
155
143
|
- color_labels = None # A dictionary of label/color, to override style colors
|
156
144
|
|
@@ -180,8 +168,13 @@ These settings are available for all chart types:
|
|
180
168
|
- base_map = None
|
181
169
|
- missing_label = None # Add a label for no data
|
182
170
|
|
171
|
+
`basemap` can be `{ISO}-{level}` or `{ISO}|{subset}-{level}`.
|
172
|
+
For example, `se-4` will show Swedish counties, while `se|03-7` will show municipalities (`se-7`) starting with `03`.
|
173
|
+
|
183
174
|
**ChoroplethMap**
|
184
175
|
|
176
|
+
_ Inherits from Map _
|
177
|
+
|
185
178
|
**ProgressChart**
|
186
179
|
|
187
180
|
**RangePlot**
|
@@ -220,13 +213,23 @@ Roadmap
|
|
220
213
|
- Getting rid of custom settings-hack
|
221
214
|
- Custom month locator with equal-width month bars
|
222
215
|
|
223
|
-
|
224
216
|
Changelog
|
225
217
|
---------
|
226
218
|
|
219
|
+
- 1.58.0
|
220
|
+
|
221
|
+
- Matplotlib==3.9
|
222
|
+
- Added `.x_range_labels` to SerialChart
|
223
|
+
- Some tweaks to title placement to avoid cropping of diactritics
|
224
|
+
|
225
|
+
- 1.57.3
|
226
|
+
|
227
|
+
- Make NW region keys work with map subsets (e.g. `SE|03-7`)
|
228
|
+
- Don't crash on subsequent calls to basemap parser
|
229
|
+
|
227
230
|
- 1.57.2
|
228
231
|
|
229
|
-
- reduce excessive padding in
|
232
|
+
- reduce excessive padding in categorical vertical charts
|
230
233
|
- improved padding and margin logic for titles/subtitles (taking line spacing into account)
|
231
234
|
|
232
235
|
- 1.57.1
|
@@ -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)
|
@@ -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")
|
@@ -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:
|
newsworthycharts-1.57.2/README.rst → newsworthycharts-1.58.0/newsworthycharts.egg-info/PKG-INFO
RENAMED
@@ -1,3 +1,16 @@
|
|
1
|
+
Metadata-Version: 2.1
|
2
|
+
Name: newsworthycharts
|
3
|
+
Version: 1.58.0
|
4
|
+
Summary: Matplotlib wrapper to create charts and publish them on Amazon S3
|
5
|
+
Home-page: https://github.com/jplusplus/newsworthycharts
|
6
|
+
Download-URL: https://github.com/jplusplus/newsworthycharts/archive/1.58.0.tar.gz
|
7
|
+
Author: Jens Finnäs and Leo Wallentin, J++ Stockholm
|
8
|
+
Author-email: stockholm@jplusplus.org
|
9
|
+
License: MIT
|
10
|
+
Requires-Python: >=3.9
|
11
|
+
Description-Content-Type: text/x-rst
|
12
|
+
License-File: LICENSE.txt
|
13
|
+
|
1
14
|
This module contains methods for producing graphs and publishing them on Amazon S3, or in the location of your choice.
|
2
15
|
|
3
16
|
It is written and maintained for `Newsworthy <https://www.newsworthy.se/en/>`_, but could possibly come in handy for other people as well.
|
@@ -138,6 +151,7 @@ These settings are available for all chart types:
|
|
138
151
|
- colors = None # A list of colors, each correspoding to one dataseries. Default behaviour is to use the style colors
|
139
152
|
- value_labels = False # Print out values at points on line?
|
140
153
|
- highlighted_x_ranges = [] # List of tuples with start and end of highlighted areas
|
154
|
+
- x_range_labels = [] # List of labels for highlighted areas
|
141
155
|
- label_placement = "legend" # legend|inline|outside
|
142
156
|
- color_labels = None # A dictionary of label/color, to override style colors
|
143
157
|
|
@@ -167,8 +181,13 @@ These settings are available for all chart types:
|
|
167
181
|
- base_map = None
|
168
182
|
- missing_label = None # Add a label for no data
|
169
183
|
|
184
|
+
`basemap` can be `{ISO}-{level}` or `{ISO}|{subset}-{level}`.
|
185
|
+
For example, `se-4` will show Swedish counties, while `se|03-7` will show municipalities (`se-7`) starting with `03`.
|
186
|
+
|
170
187
|
**ChoroplethMap**
|
171
188
|
|
189
|
+
_ Inherits from Map _
|
190
|
+
|
172
191
|
**ProgressChart**
|
173
192
|
|
174
193
|
**RangePlot**
|
@@ -207,13 +226,23 @@ Roadmap
|
|
207
226
|
- Getting rid of custom settings-hack
|
208
227
|
- Custom month locator with equal-width month bars
|
209
228
|
|
210
|
-
|
211
229
|
Changelog
|
212
230
|
---------
|
213
231
|
|
232
|
+
- 1.58.0
|
233
|
+
|
234
|
+
- Matplotlib==3.9
|
235
|
+
- Added `.x_range_labels` to SerialChart
|
236
|
+
- Some tweaks to title placement to avoid cropping of diactritics
|
237
|
+
|
238
|
+
- 1.57.3
|
239
|
+
|
240
|
+
- Make NW region keys work with map subsets (e.g. `SE|03-7`)
|
241
|
+
- Don't crash on subsequent calls to basemap parser
|
242
|
+
|
214
243
|
- 1.57.2
|
215
244
|
|
216
|
-
- reduce excessive padding in
|
245
|
+
- reduce excessive padding in categorical vertical charts
|
217
246
|
- improved padding and margin logic for titles/subtitles (taking line spacing into account)
|
218
247
|
|
219
248
|
- 1.57.1
|
@@ -3,11 +3,11 @@ Pillow==10.3.0
|
|
3
3
|
PyYAML>=3
|
4
4
|
adjustText==0.7.3
|
5
5
|
boto3>=1.26
|
6
|
-
geopandas==0.14.
|
6
|
+
geopandas==0.14.4
|
7
7
|
langcodes>=3.3
|
8
8
|
mapclassify==2.6.1
|
9
9
|
matplotlib-label-lines==0.5.1
|
10
|
-
matplotlib==3.
|
10
|
+
matplotlib==3.9.0
|
11
11
|
numpy<2,>=1.21.0
|
12
12
|
python-dateutil<3,>=2
|
13
13
|
requests>=2.22
|
@@ -25,7 +25,7 @@ setup(
|
|
25
25
|
python_requires='>=3.9',
|
26
26
|
install_requires=[
|
27
27
|
"boto3>=1.26",
|
28
|
-
"matplotlib==3.
|
28
|
+
"matplotlib==3.9.0",
|
29
29
|
"langcodes>=3.3",
|
30
30
|
"Babel>=2.14.0,<3",
|
31
31
|
"PyYAML>=3",
|
@@ -35,7 +35,7 @@ setup(
|
|
35
35
|
"Pillow==10.3.0",
|
36
36
|
"requests>=2.22",
|
37
37
|
"matplotlib-label-lines==0.5.1",
|
38
|
-
"geopandas==0.14.
|
38
|
+
"geopandas==0.14.4",
|
39
39
|
"mapclassify==2.6.1",
|
40
40
|
],
|
41
41
|
setup_requires=["flake8"],
|
@@ -24,6 +24,7 @@ def test_rendering():
|
|
24
24
|
c = ChoroplethMap.init_from(chart_obj, storage=ds)
|
25
25
|
c.render("test", "png")
|
26
26
|
|
27
|
+
|
27
28
|
def test_map_with_nw_regions():
|
28
29
|
container = {}
|
29
30
|
ds = DictStorage(container)
|
@@ -40,9 +41,29 @@ def test_map_with_nw_regions():
|
|
40
41
|
]
|
41
42
|
],
|
42
43
|
}
|
43
|
-
c = ChoroplethMap.init_from(chart_obj, storage=
|
44
|
+
c = ChoroplethMap.init_from(chart_obj, storage=ds)
|
45
|
+
c.render("map_with_nw_ids", "png")
|
46
|
+
|
47
|
+
|
48
|
+
def test_map_with_nw_regions_and_subsets():
|
49
|
+
container = {}
|
50
|
+
ds = DictStorage(container)
|
51
|
+
|
52
|
+
chart_obj = {
|
53
|
+
"width": 800,
|
54
|
+
"height": 600,
|
55
|
+
"base_map": "se|03-7",
|
56
|
+
"data": [
|
57
|
+
[
|
58
|
+
("Uppsala kommun", 3),
|
59
|
+
("Enköpings kommun", 2),
|
60
|
+
]
|
61
|
+
],
|
62
|
+
}
|
63
|
+
c = ChoroplethMap.init_from(chart_obj, storage=ds)
|
44
64
|
c.render("map_with_nw_ids", "png")
|
45
65
|
|
66
|
+
|
46
67
|
def test_invalid_region():
|
47
68
|
container = {}
|
48
69
|
ds = DictStorage(container)
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{newsworthycharts-1.57.2 → newsworthycharts-1.58.0}/newsworthycharts/translations/regions.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
{newsworthycharts-1.57.2 → newsworthycharts-1.58.0}/newsworthycharts.egg-info/dependency_links.txt
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|