newsworthycharts 1.57.2__tar.gz → 1.57.3__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.
Files changed (53) hide show
  1. newsworthycharts-1.57.3/PKG-INFO +13 -0
  2. {newsworthycharts-1.57.2 → newsworthycharts-1.57.3}/README.rst +11 -1
  3. {newsworthycharts-1.57.2 → newsworthycharts-1.57.3}/newsworthycharts/__init__.py +1 -1
  4. {newsworthycharts-1.57.2 → newsworthycharts-1.57.3}/newsworthycharts/map.py +7 -2
  5. newsworthycharts-1.57.3/newsworthycharts.egg-info/PKG-INFO +13 -0
  6. {newsworthycharts-1.57.2 → newsworthycharts-1.57.3}/setup.py +1 -2
  7. {newsworthycharts-1.57.2 → newsworthycharts-1.57.3}/test/test_choropleth_maps.py +22 -1
  8. newsworthycharts-1.57.2/PKG-INFO +0 -967
  9. newsworthycharts-1.57.2/newsworthycharts.egg-info/PKG-INFO +0 -967
  10. {newsworthycharts-1.57.2 → newsworthycharts-1.57.3}/LICENSE.txt +0 -0
  11. {newsworthycharts-1.57.2 → newsworthycharts-1.57.3}/MANIFEST.in +0 -0
  12. {newsworthycharts-1.57.2 → newsworthycharts-1.57.3}/newsworthycharts/bubblemap.py +0 -0
  13. {newsworthycharts-1.57.2 → newsworthycharts-1.57.3}/newsworthycharts/categoricalchart.py +0 -0
  14. {newsworthycharts-1.57.2 → newsworthycharts-1.57.3}/newsworthycharts/chart.py +0 -0
  15. {newsworthycharts-1.57.2 → newsworthycharts-1.57.3}/newsworthycharts/choroplethmap.py +0 -0
  16. {newsworthycharts-1.57.2 → newsworthycharts-1.57.3}/newsworthycharts/custom/__init__.py +0 -0
  17. {newsworthycharts-1.57.2 → newsworthycharts-1.57.3}/newsworthycharts/custom/climate_cars.py +0 -0
  18. {newsworthycharts-1.57.2 → newsworthycharts-1.57.3}/newsworthycharts/datawrapper.py +0 -0
  19. {newsworthycharts-1.57.2 → newsworthycharts-1.57.3}/newsworthycharts/lib/__init__.py +0 -0
  20. {newsworthycharts-1.57.2 → newsworthycharts-1.57.3}/newsworthycharts/lib/color_fn.py +0 -0
  21. {newsworthycharts-1.57.2 → newsworthycharts-1.57.3}/newsworthycharts/lib/colors.py +0 -0
  22. {newsworthycharts-1.57.2 → newsworthycharts-1.57.3}/newsworthycharts/lib/datalist.py +0 -0
  23. {newsworthycharts-1.57.2 → newsworthycharts-1.57.3}/newsworthycharts/lib/formatter.py +0 -0
  24. {newsworthycharts-1.57.2 → newsworthycharts-1.57.3}/newsworthycharts/lib/geography.py +0 -0
  25. {newsworthycharts-1.57.2 → newsworthycharts-1.57.3}/newsworthycharts/lib/locator.py +0 -0
  26. {newsworthycharts-1.57.2 → newsworthycharts-1.57.3}/newsworthycharts/lib/mimetypes.py +0 -0
  27. {newsworthycharts-1.57.2 → newsworthycharts-1.57.3}/newsworthycharts/lib/utils.py +0 -0
  28. {newsworthycharts-1.57.2 → newsworthycharts-1.57.3}/newsworthycharts/maps/se-4.gpkg +0 -0
  29. {newsworthycharts-1.57.2 → newsworthycharts-1.57.3}/newsworthycharts/maps/se-7.gpkg +0 -0
  30. {newsworthycharts-1.57.2 → newsworthycharts-1.57.3}/newsworthycharts/rangeplot.py +0 -0
  31. {newsworthycharts-1.57.2 → newsworthycharts-1.57.3}/newsworthycharts/rc/newsworthy +0 -0
  32. {newsworthycharts-1.57.2 → newsworthycharts-1.57.3}/newsworthycharts/scatterplot.py +0 -0
  33. {newsworthycharts-1.57.2 → newsworthycharts-1.57.3}/newsworthycharts/seasonalchart.py +0 -0
  34. {newsworthycharts-1.57.2 → newsworthycharts-1.57.3}/newsworthycharts/serialchart.py +0 -0
  35. {newsworthycharts-1.57.2 → newsworthycharts-1.57.3}/newsworthycharts/storage.py +0 -0
  36. {newsworthycharts-1.57.2 → newsworthycharts-1.57.3}/newsworthycharts/stripechart.py +0 -0
  37. {newsworthycharts-1.57.2 → newsworthycharts-1.57.3}/newsworthycharts/translations/datawrapper_regions.csv +0 -0
  38. {newsworthycharts-1.57.2 → newsworthycharts-1.57.3}/newsworthycharts/translations/regions.py +0 -0
  39. {newsworthycharts-1.57.2 → newsworthycharts-1.57.3}/newsworthycharts/translations/se_municipalities.csv +0 -0
  40. {newsworthycharts-1.57.2 → newsworthycharts-1.57.3}/newsworthycharts.egg-info/SOURCES.txt +0 -0
  41. {newsworthycharts-1.57.2 → newsworthycharts-1.57.3}/newsworthycharts.egg-info/dependency_links.txt +0 -0
  42. {newsworthycharts-1.57.2 → newsworthycharts-1.57.3}/newsworthycharts.egg-info/not-zip-safe +0 -0
  43. {newsworthycharts-1.57.2 → newsworthycharts-1.57.3}/newsworthycharts.egg-info/requires.txt +0 -0
  44. {newsworthycharts-1.57.2 → newsworthycharts-1.57.3}/newsworthycharts.egg-info/top_level.txt +0 -0
  45. {newsworthycharts-1.57.2 → newsworthycharts-1.57.3}/setup.cfg +0 -0
  46. {newsworthycharts-1.57.2 → newsworthycharts-1.57.3}/test/test_categorical_chart.py +0 -0
  47. {newsworthycharts-1.57.2 → newsworthycharts-1.57.3}/test/test_custom_climate_cars.py +0 -0
  48. {newsworthycharts-1.57.2 → newsworthycharts-1.57.3}/test/test_data_list.py +0 -0
  49. {newsworthycharts-1.57.2 → newsworthycharts-1.57.3}/test/test_datawrapper.py +0 -0
  50. {newsworthycharts-1.57.2 → newsworthycharts-1.57.3}/test/test_main.py +0 -0
  51. {newsworthycharts-1.57.2 → newsworthycharts-1.57.3}/test/test_rangeplot.py +0 -0
  52. {newsworthycharts-1.57.2 → newsworthycharts-1.57.3}/test/test_scatterplot.py +0 -0
  53. {newsworthycharts-1.57.2 → newsworthycharts-1.57.3}/test/test_serial_chart.py +0 -0
@@ -0,0 +1,13 @@
1
+ Metadata-Version: 2.1
2
+ Name: newsworthycharts
3
+ Version: 1.57.3
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.3.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
+ License-File: LICENSE.txt
12
+
13
+ Matplotlib wrapper to create charts and publish them on Amazon S3
@@ -167,8 +167,13 @@ These settings are available for all chart types:
167
167
  - base_map = None
168
168
  - missing_label = None # Add a label for no data
169
169
 
170
+ `basemap` can be `{ISO}-{level}` or `{ISO}|{subset}-{level}`.
171
+ For example, `se-4` will show Swedish counties, while `se|03-7` will show municipalities (`se-7`) starting with `03`.
172
+
170
173
  **ChoroplethMap**
171
174
 
175
+ _Inherits from Map_
176
+
172
177
  **ProgressChart**
173
178
 
174
179
  **RangePlot**
@@ -211,9 +216,14 @@ Roadmap
211
216
  Changelog
212
217
  ---------
213
218
 
219
+ - 1.57.3
220
+
221
+ - Make NW region keys work with map subsets (e.g. `SE|03-7`)
222
+ - Don't crash on subsequent calls to basemap parser
223
+
214
224
  - 1.57.2
215
225
 
216
- - reduce excessive padding in ctagoerical vertical charts
226
+ - reduce excessive padding in categorical vertical charts
217
227
  - improved padding and margin logic for titles/subtitles (taking line spacing into account)
218
228
 
219
229
  - 1.57.1
@@ -1,4 +1,4 @@
1
- __version__ = "1.57.2"
1
+ __version__ = "1.57.3"
2
2
 
3
3
  from .chart import Chart
4
4
  from .choroplethmap import ChoroplethMap
@@ -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
- region_translation = REGION_TRANSLATIONS.get(self.base_map, {})
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 not self.df:
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")
@@ -0,0 +1,13 @@
1
+ Metadata-Version: 2.1
2
+ Name: newsworthycharts
3
+ Version: 1.57.3
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.3.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
+ License-File: LICENSE.txt
12
+
13
+ Matplotlib wrapper to create charts and publish them on Amazon S3
@@ -14,8 +14,7 @@ setup(
14
14
  name="newsworthycharts",
15
15
  version=version,
16
16
  description="Matplotlib wrapper to create charts and publish them on Amazon S3",
17
- long_description=readme(),
18
- long_description_content_type='text/x-rst',
17
+ long_description="Matplotlib wrapper to create charts and publish them on Amazon S3",
19
18
  url=repo,
20
19
  author="Jens Finnäs and Leo Wallentin, J++ Stockholm",
21
20
  author_email="stockholm@jplusplus.org",
@@ -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=local_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)