newsworthycharts 1.57.2__py3-none-any.whl → 1.57.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.
@@ -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
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
- 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,26 @@
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
+ Requires-Dist: Babel <3,>=2.14.0
13
+ Requires-Dist: Pillow ==10.3.0
14
+ Requires-Dist: PyYAML >=3
15
+ Requires-Dist: adjustText ==0.7.3
16
+ Requires-Dist: boto3 >=1.26
17
+ Requires-Dist: geopandas ==0.14.3
18
+ Requires-Dist: langcodes >=3.3
19
+ Requires-Dist: mapclassify ==2.6.1
20
+ Requires-Dist: matplotlib-label-lines ==0.5.1
21
+ Requires-Dist: matplotlib ==3.8.4
22
+ Requires-Dist: numpy <2,>=1.21.0
23
+ Requires-Dist: python-dateutil <3,>=2
24
+ Requires-Dist: requests >=2.22
25
+
26
+ Matplotlib wrapper to create charts and publish them on Amazon S3
@@ -1,10 +1,10 @@
1
- newsworthycharts/__init__.py,sha256=KmKpBttYKLayAfnuYYhLGJXXIEJpN8HluaOsuR1GFIw,1160
1
+ newsworthycharts/__init__.py,sha256=PpwFsYOJecyNvthtoUo5_8GuiKOUzpCvdL30xQmHLqQ,1160
2
2
  newsworthycharts/bubblemap.py,sha256=nkocWmpiFgfjEuJGAsthjY5X7Q56jXWsZHUGXw4PwgE,2587
3
3
  newsworthycharts/categoricalchart.py,sha256=LwOZ3VbNy9vzvoK0s77AkbfMt4CXVDSAhnsnBInUIrE,14764
4
4
  newsworthycharts/chart.py,sha256=zVBkbCX4c3JjPhweXPXELkxbYMJDX1jSDVsoTfS1A7k,30634
5
5
  newsworthycharts/choroplethmap.py,sha256=2b61MuYed8ccc7uZkzuSdZDbqVR7C3OP1ftb_khuaLw,6069
6
6
  newsworthycharts/datawrapper.py,sha256=RRkAVTpfP4updKxUIBaSmKuBi2RUVPaBRF8HDQhlGGA,11250
7
- newsworthycharts/map.py,sha256=e0WRcLTmb1KPZ7_-05QXgthMEmKrTpnci40DXnmd6Rc,5984
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
@@ -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.57.2.dist-info/LICENSE.txt,sha256=Sq6kGICrehbhC_FolNdXf0djKjTpv3YqjFCIYsxdQN4,1069
32
- newsworthycharts-1.57.2.dist-info/METADATA,sha256=1OrCBrpa5SOFS01LD7FlqCo3CIIO_ok4rBKmg1TGo3c,26527
33
- newsworthycharts-1.57.2.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
34
- newsworthycharts-1.57.2.dist-info/top_level.txt,sha256=dn_kzIj8UgUCMsh1PHdVEQJHVGSsN7Z8YJF-8xXa8n0,17
35
- newsworthycharts-1.57.2.dist-info/RECORD,,
31
+ newsworthycharts-1.57.3.dist-info/LICENSE.txt,sha256=Sq6kGICrehbhC_FolNdXf0djKjTpv3YqjFCIYsxdQN4,1069
32
+ newsworthycharts-1.57.3.dist-info/METADATA,sha256=QyG_NW74zoiyh0PNXGRD_WrYS3GkvCeVoJEAbST2cUQ,930
33
+ newsworthycharts-1.57.3.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
34
+ newsworthycharts-1.57.3.dist-info/top_level.txt,sha256=dn_kzIj8UgUCMsh1PHdVEQJHVGSsN7Z8YJF-8xXa8n0,17
35
+ newsworthycharts-1.57.3.dist-info/RECORD,,
@@ -1,980 +0,0 @@
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
- Requires-Dist: Babel <3,>=2.14.0
14
- Requires-Dist: Pillow ==10.3.0
15
- Requires-Dist: PyYAML >=3
16
- Requires-Dist: adjustText ==0.7.3
17
- Requires-Dist: boto3 >=1.26
18
- Requires-Dist: geopandas ==0.14.3
19
- Requires-Dist: langcodes >=3.3
20
- Requires-Dist: mapclassify ==2.6.1
21
- Requires-Dist: matplotlib-label-lines ==0.5.1
22
- Requires-Dist: matplotlib ==3.8.4
23
- Requires-Dist: numpy <2,>=1.21.0
24
- Requires-Dist: python-dateutil <3,>=2
25
- Requires-Dist: requests >=2.22
26
-
27
- This module contains methods for producing graphs and publishing them on Amazon S3, or in the location of your choice.
28
-
29
- It is written and maintained for `Newsworthy <https://www.newsworthy.se/en/>`_, but could possibly come in handy for other people as well.
30
-
31
- By `Journalism++ Stockholm <http://jplusplus.org/sv>`_.
32
-
33
- Installing
34
- ----------
35
-
36
- .. code-block:: bash
37
-
38
- pip install newsworthycharts
39
-
40
-
41
- Using
42
- -----
43
-
44
- This module comes with two classes, `Chart` and `Storage` (and it's subclasses).
45
- When using the Chart class, the generated chart will be saved as a local file:
46
-
47
- .. code-block:: python3
48
-
49
- from newsworthycharts import SerialChart as Chart
50
-
51
-
52
- c = Chart(600, 800)
53
- c.title = "Number of smiles per second"
54
- c.xlabel = "Time"
55
- c.ylabel = "Smiles"
56
- c.caption = "Source: Ministry of smiles."
57
- data_serie_1 = [("2008-01-01", 6.1), ("2009-01-01", 5.9), ("2010-01-01", 6.8)]
58
- c.data.append(data_serie_1)
59
- c.highlight = "2010-01-01"
60
- c.render("test", "png")
61
-
62
- You can use one of the predefine chart classes to make common chart types. Or you can use Newsworthycharts together with Matplotlib. This is useful is you just want to add text elements such as subtitle, notes or apply a predefine theme.
63
-
64
- Here is how you would make a pie chart:
65
-
66
- .. code-block:: python3
67
-
68
- # data
69
- labels = 'Frogs', 'Hogs', 'Dogs', 'Logs'
70
- sizes = [15, 30, 45, 10]
71
-
72
- # setup chart
73
- chart = Chart(width=800, height=600, storage=local_storage)
74
- chart.title = "My pie chart"
75
- chart.subtitle = "Look at all those colors"
76
-
77
- # NB: Render the chart to `chart.ax`
78
- chart.ax.pie(sizes, labels=labels, autopct='%1.1f%%')
79
-
80
- # Save the chart
81
- chart.render("tailored_chart", "png")
82
-
83
- You can use a _storage_ object to save file to
84
- a specific location or cloud service:
85
-
86
- .. code-block:: python3
87
-
88
- from newsworthycharts import Chart
89
- from newsworthycharts import S3Storage
90
-
91
- s3 = S3Storage("my_bucket")
92
- c = Chart(600, 800, storage=s3)
93
- c.title = "Number of smiles per second"
94
- c.subtitle = "This chart tells you something very important."
95
- c.xlabel = "Time"
96
- c.ylabel = "Smiles"
97
- c.note = "There are some missing smiles in data"
98
- c.caption = "Source: Ministry of smiles."
99
- c.render("test", "png")
100
-
101
-
102
- To store a file in a local folder, use the `LocalStorage` class:
103
-
104
- .. code-block:: python3
105
-
106
- from newsworthycharts import LocalStorage
107
-
108
- storage = LocalStorage("/path/to/generated/charts")
109
-
110
- Charts are styled using built-in or user-defined styles:
111
-
112
- .. code-block:: python3
113
-
114
- from newsworthycharts import Chart
115
-
116
- # This chart has the newsworthy default style
117
- c = Chart(600, 800, style="newsworthy")
118
-
119
- # Style can also be the path to a style file (absolute or relative to current working directory)
120
- c2 = Chart(600, 800, style="path/to/styles/mystyle.mplstyle")
121
-
122
- To set up you own style, copy the build-in default: <https://github.com/jplusplus/newsworthycharts/blob/master/newsworthycharts/rc/newsworthy>
123
-
124
- Newsworthycharts will look first among the predefined style files for the requested style, so if you have a custom style file in you working directory you need to give it a unique name not already in use.
125
-
126
- Options
127
- -------
128
-
129
- **Chart**
130
-
131
- These settings are available for all chart types:
132
-
133
- - data: A list of datasets
134
- - annotate_trend = True # Print out values at points on trendline?
135
- - trendline = [] # List of x positions, or data points
136
- - yline = None # A horizontal line across the chart (Matplotlib: axhline)
137
- - labels = [] # Optionally one label for each dataset
138
- - annotations = [] # Manually added annotations
139
- - interval = None # yearly|quarterly|monthly|weekly|daily
140
- - units = 'number' # number|percent|degrees
141
- - show_ticks = True # toggle category names, dates, etc
142
- - subtitle = None
143
- - note = None
144
- - xlabel = None
145
- - ylabel = None
146
- - caption = None
147
- - highlight = A position (typically a date, category label or index) to highlight. The semantics may differ somewhat between chart types.
148
- - decimals = None # None means automatically chose the best number
149
- - logo = None # Path to image that will be embedded in the caption area. Can also be set though a style property
150
- - color_fn = None # Custom coloring function
151
-
152
- **SerialChart**
153
-
154
- - type = 'line' # line|bar|stacked_bar
155
- - bar_width = 0.9 # percent of data point width
156
- - allow_broken_y_axis = True|False # default depends on chart type
157
- - baseline = 0 # The “zero” line. Useful for plotting deviations, e.g. temperatures above/below mean
158
- - baseline_annotation = None # A label for the baseline
159
- - line_width = None # To override style settings
160
- - max_ticks = 7 # Maximum number of ticks on the x axis
161
- - ticks = None # Custom ticks on the x axis, as a list of lists or tuples: `[(2013-01-01, "-13"), (2014-01-01, "-14"), (2015-01-01, "-15")]`
162
- - ymin = None # Minimum value on y axis. If None, it will be calculated from data
163
- - ymax = None # Maximum value on y axis. If None, it will be calculated from data
164
- - colors = None # A list of colors, each correspoding to one dataseries. Default behaviour is to use the style colors
165
- - value_labels = False # Print out values at points on line?
166
- - highlighted_x_ranges = [] # List of tuples with start and end of highlighted areas
167
- - label_placement = "legend" # legend|inline|outside
168
- - color_labels = None # A dictionary of label/color, to override style colors
169
-
170
- **SeasonalChart**
171
-
172
- **BubbleMap**
173
-
174
- - bubble_size = 1 # The size of the bubbles
175
-
176
- **CategoricalChart**
177
-
178
- - bar_orientation = "horizontal" # [horizontal|vertical]
179
- - annotation_rotation = 0
180
- - stacked = False
181
- - legend = True
182
- - colors = None
183
-
184
- **CategoricalChartWithReference**
185
-
186
- **Map**
187
-
188
- - bins = 9 # Number of bins for continuous data
189
- - binning_method = "natural_breaks"
190
- - colors = None
191
- - color_ramp = "YlOrRd"
192
- - categorical = False # If True, the map will be colored by category. If False, it will be colored by a continuous value
193
- - base_map = None
194
- - missing_label = None # Add a label for no data
195
-
196
- **ChoroplethMap**
197
-
198
- **ProgressChart**
199
-
200
- **RangePlot**
201
-
202
- **ScatterPlot**
203
-
204
- **StripeChart**
205
-
206
- Developing
207
- ----------
208
-
209
- To run tests:
210
-
211
- .. code-block:: python3
212
-
213
- python3 -m flake8
214
- python3 -m pytest
215
-
216
- Deployment
217
- ----------
218
-
219
- To deploy a new version to [PyPi](https://pypi.org/project/newsworthycharts):
220
-
221
- 1. Update Changelog below.
222
- 2. Update the version number in newsworthycharts/__init__.py
223
- 3. Create and push a git tag: `git tag VERSION; git push --tags` (not strictly needed, but nice)
224
- 4. Build: `python3 setup.py sdist bdist_wheel`
225
- 5. Check: `python3 -m twine check dist/newsworthycharts-X.Y.X*`
226
- 6. Upload: `python3 -m twine upload dist/newsworthycharts-X.Y.X*`
227
-
228
- ...assuming you have Twine installed (`pip3 install twine`) and configured.
229
-
230
- Roadmap
231
- -------
232
- - Adding more base maps
233
- - Getting rid of custom settings-hack
234
- - Custom month locator with equal-width month bars
235
-
236
-
237
- Changelog
238
- ---------
239
-
240
- - 1.57.2
241
-
242
- - reduce excessive padding in ctagoerical vertical charts
243
- - improved padding and margin logic for titles/subtitles (taking line spacing into account)
244
-
245
- - 1.57.1
246
-
247
- - Fix missing outline in choropleth maps
248
- - matplotlib==3.8.4; Pillow==10.3.0
249
-
250
- - 1.57.0
251
-
252
- - Changed z-ordering so that line are always on top of bars, and ylines/zero lines are behind lines but in front of bars
253
- - Avoid using the same color for trendline and lines
254
- - `yline` was moved to the SerialChart class, where it makes sense.
255
-
256
- - 1.56.0
257
-
258
- - Reverted trendline behaviour to 1.54
259
- - Added `yline` to add a horizontal line across the chart (Matplotlib: axhline).
260
-
261
- - 1.55.0
262
-
263
- - Always use neutral color for trendline
264
-
265
- - 1.54.6
266
-
267
- - Improved logic for trendline coloring
268
- - Somewhat thinner trendline
269
-
270
- - 1.54.5
271
-
272
- - Improved tick placement in daily charts
273
- - Minor upgrades: matplotlib==3.8.3; Pillow==10.2.0; geopandas==0.14.3
274
-
275
- - 1.54.4
276
-
277
- - Use Babel 2.14, and pin version
278
- - Require numpy>=1.21.0 (now required by Matplotlib)
279
- - Patch upgrades: matplotlib==3.8.2; geopandas==0.14.1
280
-
281
- - 1.54.3
282
-
283
- - Fix duplicated integer values in y axis
284
-
285
- - 1.54.2
286
-
287
- - Make sure that legend is always on top of bars in stacked bar charts
288
- - Support more stacked categories in serial bar charts
289
-
290
- - 1.52.2+
291
-
292
- - Backport various 1.54.x fixes
293
-
294
- - 1.54.1
295
-
296
- - Patch upgrade Matplotlib to 3.8.1
297
-
298
- - 1.54.0
299
-
300
- - Treat 'jpeg' format as 'jpg'
301
- - Fixed a rendering bug in stacked bar charts with multiple values being 0
302
- - Pillow upgraded to 10.1
303
-
304
- - 1.53.0
305
-
306
- - Fixed bug in value_labels, trying to access a color value that didn't exist
307
- - Dropped Python 3.8 support (upstream)
308
- - Uses Matplotlib 3.8
309
- - Uses Pillow 10
310
-
311
- - 1.52.1
312
-
313
- - Fixed date formatting issue in daily charts
314
-
315
- - 1.52.0
316
-
317
- - No longer render EPS files by default.
318
-
319
- - 1.51.2
320
-
321
- - _Really_ fix dependencies
322
-
323
- - 1.51.1
324
-
325
- - Fix error in dependency verison
326
-
327
- - 1.51.0
328
-
329
- - Added `BubbleMap`
330
- - Added `se-4` basemap for Swedish counties
331
- - Basemaps can now have multiplygons
332
- - Downgraded adjustText to 0.7.3, as upgrade broke rendering constistency in some places
333
-
334
- - 1.50.2
335
-
336
- - Revert `matplotlib-label-lines` to previous version.
337
-
338
- - 1.50.0
339
-
340
- - Dropped Python 3.7 support (upstream)
341
- - Pinned Pillow to exact version in setup.py, for consistent rendering
342
- - `StripeChart`: First draft
343
-
344
- - 1.49.1
345
-
346
- - `ProgressChart`: Better value label placement.
347
-
348
- - 1.49.0
349
-
350
- - `ProgressChart`: Enable custom value labels as third argument in data serie.
351
-
352
- - 1.48.2
353
-
354
- - Bug fix: Handle translation in inset maps in `ChoroplethMap`.
355
-
356
- - 1.48.1
357
-
358
- - Bug fix: Path to translation file in `ChoroplethMap`.
359
-
360
- - 1.48.0
361
-
362
- - `ChoroplethMap`: Allow Newsworthy region names.
363
- - `RangePlot`: Re-add `start_label` that had been (mistakenly?) commented out.
364
-
365
- - 1.47.2
366
-
367
- - Bug fix: Fixes legend issue in `ProgressChart`.
368
-
369
- - 1.47.1
370
-
371
- - Data point annotation now works for serial charts as well
372
- - Bug fix: Re-enable `qualitative_colors` as `color` argument in SerialChart (line).
373
-
374
- - 1.47.0
375
-
376
- - Support for rendering jpeg files, as `jpg`
377
- - Minimum required Python version is now 3.7 (jumping from 3.5)
378
- - Matplotlib@3.7.1
379
-
380
- - 1.46.3
381
-
382
- - Fix z-ordering issue on multiple series (n > 2)
383
-
384
- - 1.46.2
385
-
386
- - Fix tag mismatch in dist
387
-
388
- - 1.46.1
389
-
390
- - Add missing haversine transform for non-projected crs
391
-
392
- - 1.46.0
393
-
394
- - `height` can be set to None for automatic ratio, for chart types that support it. Will default to 1:1 for most chart types, but maps will try to provide a reasonable default based on geometry. Some chart types still require explicit height
395
- - It is now possible to use subsets of basemaps, by specifying a prefix: `se|03-7` means regions starting with `03` in `se-7`
396
- - Added .missing_label to ChoroplethMap. If None (default), no label will be printed.
397
- - Always accentuate base_line (/y=0), and make sure that line is on top of any bars to avoid “floating” bars
398
- - Improved error handling in ChoroplethMap
399
- - Clean up figure layout logic (this should speed up rendering somewhat)
400
-
401
- - 1.45.0
402
-
403
- - Increased default `max_ticks` in SerialChart to 7
404
- - Matplotlib==3.7.0
405
- - adjustText==0.8.0
406
- - ChoroplethMap legend formatting, following language, decimals and units settings, etc
407
- - Minor tweaks to the layout algorithm. Might affect padding in some charts.
408
- - ChoroplethMap now does some basic normalizing of region codes
409
- - Added some data sanity checks, and improved error messages in ChoroplethMap
410
- - Added tests for ChoroplethMap
411
-
412
- - 1.44.4
413
-
414
- - Do not default to broken y axis if chart contains a bar series.
415
-
416
- - 1.44.3
417
-
418
- - Fix bug and occasional crash when using baseline with None values
419
-
420
- - 1.44.2
421
-
422
- - Fix crash in serialchart coloring chain
423
-
424
- - 1.44.1
425
-
426
- - Fix regression in SeasonalChart bar coloring
427
-
428
- - 1.44.0
429
-
430
- - Added grey outline to choropleth maps
431
- - The `type` argument is now a list with one type per data serie. Using a string is still supported for backwards compability. This makes it possible to make mixed type charts.
432
- - Reworked, simpler and more stable bar coloring algorithm
433
- - The `type` argument is no longer a getter/setter
434
- - Reduced edge for bar chartswith many bars
435
- - Removed unused, undocumented special colors value `"qualitative_colors"`. We have reasonable defaults for all chart types, that can already be overridden. The qualitative colors are used by default for qualitative data.
436
- - Removed unused, undocumented support for highlighting a series by label, rather than a value. The first series is highlighted by default, and that behaviour can already be overriden by the `.colors` setting
437
-
438
- - 1.43.4
439
-
440
- - Add more space for label title on se-7 maps
441
-
442
- - 1.43.3
443
-
444
- - Don't try to render map insets with no data
445
- - Use style colors in categorical choropleth maps
446
- - Added missing support for coloring categorical maps with `.colors`
447
- - Make automatic labeling work on categorical maps with `.colors`
448
- - Somewhat lighter fill for missing values in choropleth maps (lightgray -> gainsboro)
449
- - Testing experimental label_title support, to be documented in 1.44.0
450
-
451
- - 1.43.2
452
-
453
- - Fixed weird ymax in some baseline cases
454
- - Added bottom padding when baseline was below data-min
455
-
456
- - 1.43.1
457
-
458
- - Fixed cut off-bug with negative baseline
459
- - Fix coloring bug in warm_cold color_fn with baseline
460
- - Fix regression with quarterly locator
461
-
462
- - 1.43.0
463
-
464
- - Default to weekdays on x-axis if data spans 7 days or less
465
- - Added `.color_labels` to label bar colors set by `.color_fn`
466
-
467
- - 1.42.0
468
-
469
- - Added `.baseline` setting for bar charts
470
- - `warm_cold` coloring algorithm now works relative `.baseline`
471
- - Added `.baseline_annotation`
472
- - `.color_fn` can now be a lambda function (or the name of one of the built in functions), e.g. `chart.color_fn = lambda x: "red" if x < 1.4 else "green"`
473
- - Bar charts will now always have a small white edge
474
- - Don't break y axis if data is close to 0
475
- - Offset quarters will be recognosed as quarters now (e.g. Feb, May, Aug, Nov)
476
- - Fixed bug in .allow_broken_y_axis implementation, causing y-axis to be broken in too many places
477
- - Various dependency updates
478
- - Replaced deprecated PIL.Image.ANTIALIAS with PIL.Image.Resampling.LANCZOS for logotype resizing.
479
- - Get rid of warnings about missing “glyph 10” when prerendering text to calculate text bos sizes
480
- - Fixed bug where single values surrounded my None's were not printed out in serial-data line charts. This was an earlier regression that was not noticed for many releases.
481
-
482
- - 1.41.0
483
-
484
- - New, experimental chart type: Choropleth maps! Supports both categorical and continuous data.
485
- - Better support for monthly time series spanning years
486
- - Fixed bug where missing annotation slots could crash CategoricalChart
487
-
488
- - 1.40.2
489
-
490
- - Don't crash on deprecation warning
491
- - Matplotlib upgraded from 3.6.2 to 3.6.3
492
- - Pin some critical requirement versions
493
-
494
- - 1.40.1
495
-
496
- - Fix floating point bug in percent labels
497
- - Test fixes
498
-
499
- - 1.40.0
500
-
501
- - Auto-decide `.decimals` if None
502
- - Round 0.5 to 1, etc in value axis labels and annotations (the `ROUND_HALF_UP` behaviour)
503
- - Add `.force_decimals` to print out e.g. ”1.0”. Requires `.decimals` to be explicitly set
504
- - Serial Chart: Allow disabling ”broken y axis” feature by setting `allow_broken_y_axis=False`
505
- - Deprecated `units="count"`. Make all numbers equal. Use `units="number"` and `decimals=0` to get the earlier behaviour.
506
- - Remove overriding of decimal settings by units = count
507
- - Remove noisy deprecation warning on user settings in rc files
508
- - Formatters will now use the correct minus signs for the given locale.
509
-
510
- - 1.39.1
511
-
512
- - Added missing metadata to svg
513
- - Added .__version__ attribute to the package
514
-
515
- - 1.39.0
516
-
517
- - Added pdf export, now more widely used than eps
518
- - Author and software metadata now added to pdf and png, including the exakt NWCharts version used to produce an image
519
-
520
- - 1.38.2
521
-
522
- - `S3Storage`: Handle text files.
523
-
524
- - 1.38.1
525
-
526
- - Prevent logo from ever being > 155px, to restore previous behaviour.
527
-
528
- - 1.38.0
529
-
530
- - Made multi series bar seasonal bar charts work for opposite signs, so that we can make +/- charts
531
-
532
- - 1.37.3
533
-
534
- - Bug fix: Don't crash with factor argument in DW charts.
535
-
536
- - 1.37.2
537
-
538
- - Fixed rendering bug in non-transparent eps exports with transparent logos
539
-
540
- - 1.37.1
541
-
542
- - Fixed bug in argument parsing in S3Storage.save()
543
-
544
- - 1.37.0
545
-
546
- - Added `storage_options` argument to `render()` and `render_all()`
547
- - Unified function signatures across storage classes.
548
-
549
- - 1.36.0
550
-
551
- - Added options argument to `S3Storage.save()`
552
-
553
- - 1.35.0
554
-
555
- - Enable logo scaling. Provided logos can now be any size, and will be scaled down to an appopriate format.
556
-
557
- - 1.34.0
558
-
559
- - Adds `factor` argument to `.render()` and `.render_all()`.
560
- - Adds missing `transparent` argument to `.render_all()`.
561
- - Matplotlib @ 3.6.2
562
- - langcodes @ 3.3 to ensure consistent handling of macro languages (`no` is a valid language)
563
-
564
- - 1.33.0:
565
-
566
- - Adds `transparent` argument to render method.
567
-
568
- - 1.32.3
569
-
570
- - `ScatterPlot`: Mark labeled dots more clearly.
571
-
572
- - 1.32.2
573
-
574
- - `SerialChart`: Better error when timepoints are duplicated.
575
-
576
- - 1.32.1
577
-
578
- - Bug fixes: Handle negative values when `ymin=0` in SerialChart and remove line stroke from `highlighted_x_ranges`.
579
-
580
- - 1.32.0
581
-
582
- - `SerialChart`: New options: `line_width` and `highlighted_x_ranges`.
583
-
584
- - 1.31.0
585
-
586
- - Added `label_placement='outside'` option to SerialChart
587
-
588
- - 1.30.0
589
-
590
- - Matplotlib updated from 3.3 to 3.6, including among many, many other things:
591
- - support for .webp
592
- - a lot of additions and improvements to rcParams
593
- - new backends
594
- - Custom NWCharts parameters to the rc style file is being deprecated, and should eventually be phased out
595
- - Matplotlib and related modules are now pinned to a specific version
596
- - Added support for generating webp images!
597
- - Upgraded pytest to support Python 3.10+
598
- - Fixed date locators to use thecorrect langauge/locale
599
- - Added padding on top of title, to avoid cropping diactritics
600
-
601
- - 1.29.0
602
-
603
- - `CategoricalChart`: Make it possible to hide legend.
604
-
605
- - 1.28.1
606
-
607
- - `CategoricalChartWithReference`: Handle multi color bars.
608
-
609
- - 1.28.0
610
-
611
- - `Chart` / `SerialChart`: New feature: Mark broken y axis with symbol.
612
-
613
- - 1.27.1
614
-
615
- - `SerialChart`: Force y axis range to to given values when `ymax` and `ymin` is defined.
616
-
617
- - 1.27.0
618
-
619
- - `SerialChart`: Enable value labeling of each point on line.
620
-
621
- - 1.26.1
622
-
623
- - Highlight only current value in SeasonalChart; use different shades of grey for the rest
624
-
625
- - 1.26.0
626
-
627
- - Add `SeasonalChart`, a.k.a the Olsson chart
628
-
629
- - 1.25.3
630
-
631
- - ProgressChart: Handle missing values
632
- - `lib.formatter.Formatter`: Handle null values
633
-
634
- - 1.25.2
635
-
636
- - ScatterPlot: Enable ymin and xmin in scatterplot.
637
-
638
- - 1.25.1
639
-
640
- - Color annoation outline by background color.
641
-
642
- - 1.25.0
643
-
644
- - Improved ScatterPlot.
645
-
646
- - 1.24.1
647
-
648
- - Bug fix: Inline labeling on charts with missing data.
649
-
650
- - 1.24.0
651
-
652
- - CategoricalChartWithReference: Adds highlight option
653
-
654
- - 1.23.1
655
-
656
- - Adds missing dependency.
657
-
658
- - 1.23.0
659
-
660
- - SerialChart: Introduces inline labeling on lines
661
-
662
- - 1.22.1
663
-
664
- - Tweeks on line labeling
665
-
666
- - 1.22.0
667
-
668
- - SerialChart: Introduces labeling on lines (rather than just legends)
669
-
670
- - 1.21.5
671
-
672
- - Bug fix: Handle charts without ticks to be able to render pie charts again
673
-
674
- - 1.21.4
675
-
676
- - Beter height handling in header and footer.
677
- - Make Noto Sans default font.
678
-
679
- - 1.21.3
680
-
681
- - Enable colors property in stacked bar SerialChart.
682
-
683
- - 1.21.2
684
-
685
- - Adjusts x margin in RangePlot to fit value labels better.
686
- - Increases line spacing in subtitle.
687
-
688
- - 1.21.1
689
-
690
- - Bug fix: Small change in Datawrapper API.
691
- - Make ticks option work with SerialChart.init_from
692
-
693
- - 1.21.0
694
-
695
- - New feature: Use base `Chart` class to make custom charts.
696
- - Bug fix: Labels outside canvas in RangePlot
697
-
698
- - 1.20.2
699
-
700
- - ClimateCars: Tweeks on 2030 chart.
701
-
702
- - 1.20.1
703
-
704
- - Handle np.int as years.
705
-
706
- - 1.20.0
707
-
708
- - CategoricalChart: Highlight multiple values with list
709
- - Bug fix: ylabel placed outside canvas
710
- - Style: Align caption with note
711
-
712
- - 1.19.2
713
-
714
- - RangePlot: Better label margins and bold labels.
715
-
716
- - 1.19.1
717
-
718
- - RangePlot: Rename argument values_labels => value_labels.
719
-
720
-
721
- - 1.19.0
722
-
723
- - Pick up qualitative colors from style file.
724
-
725
- - 1.18.1
726
-
727
- - Fixed coloring on highlighted progress charts.
728
- - Adds ability to highlight both ends on range plot.
729
-
730
- - 1.18.0
731
-
732
- - Added `ticks` option to SerialChart, to set custom x-axis ticks
733
- - Added color option to CategoricalChart, to work exactly as in SerialChart
734
- - Fixed bug with highlight in line charts where some line was outside the highlighted date.
735
-
736
-
737
- - 1.17.0
738
-
739
- - Enable multiple targets in progress chart.
740
-
741
- - 1.16.2
742
-
743
- - Fixes highlight bug in progress chart.
744
-
745
- - 1.16.1
746
-
747
- - Small changes in range plot.
748
-
749
- - 1.16.0
750
-
751
- - Adds CO2 budget chart
752
-
753
- - 1.15.2
754
-
755
- - ClimateCar chart tweeks.
756
-
757
- - 1.15.1
758
-
759
- - Bug fix: Adds newsworthycharts.custom to build.
760
-
761
- - 1.15.0
762
-
763
- - Introduces progress charts and removes hard coded font sizes.
764
-
765
- - 1.14.0
766
-
767
- - Introduces range plots and enables custom coloring in serial charts.
768
-
769
- - 1.13.3
770
-
771
- - Fit long ticks on y axis.
772
-
773
- - 1.13.2
774
-
775
- - Set annotation fontsize to same as ticks by default.
776
-
777
- - 1.13.1
778
-
779
- - Bug fix: Subtitle placement
780
-
781
- - 1.13.0
782
-
783
- - Introduces subtitle and note.
784
- - Updates default styles to align with Newsworthy style guide.
785
-
786
-
787
- - 1.12.1
788
-
789
- - Fit footer by logo height. Fixes bug that caused axis overlag when logo was large.
790
-
791
- - 1.12.0
792
-
793
- - Introduces stacked categorical bar charts
794
-
795
- - 1.11.2
796
-
797
- - Bug fix: Remove failing attemt to store chart in dw format
798
-
799
-
800
- - 1.11.1
801
-
802
- - Corrects zorder and centers tick on CategoricalChartWithReference
803
-
804
- - 1.11.0
805
-
806
- - Introduces new chart: CategoricalChartWithReference
807
-
808
- - 1.10.1
809
-
810
- - Fixes bad X ticks in weekly SerialChart (and charts that don't start in January).
811
-
812
- - 1.10.0
813
-
814
- - Add annotation_rotation option to categorical charts
815
- - Fix a crash in some special cases with serial charts shorter than a year.
816
- - Fix a bug where diff between series was not highlighted if one value was close to zero.
817
-
818
- - 1.9.2
819
-
820
- - Include translations in build.
821
-
822
- - 1.9.1
823
-
824
- - Translates region to Datawrapper standard when making maps.
825
-
826
- - 1.9.0
827
-
828
- - Allows list of dicts to be passed to DatawrapperChart to be make tables, categorical maps etc.
829
-
830
- - 1.8.2
831
-
832
- - Require requests.
833
-
834
- - 1.8.1
835
-
836
- - Bug fixes.
837
-
838
- - 1.8.0
839
-
840
- - Introduces Datawrapper Chart type.
841
-
842
- - 1.7.0
843
-
844
- - Adds ymax argument (to SerialChart)
845
- - Bug fix: Handle missing values in SerialChart with line.
846
-
847
- - 1.6.12
848
-
849
- - Bug fix: Set y max to stacked max in stacked bar chart.
850
-
851
- - 1.6.11
852
-
853
- - Introduces stacked bars to SerialChart.
854
-
855
- - 1.6.10
856
-
857
- - Fixes bar_orientation bug with `init_from()`
858
-
859
- - 1.6.9
860
-
861
- - Fix an ugly bug where type=line would not work with `init_from()`
862
-
863
- - 1.6.8
864
-
865
- - Some cosmetic changes: no legend if only one series, color updates, thinner zero line.
866
-
867
-
868
- - 1.6.7
869
-
870
- - Make title and units work with `init_from` again
871
-
872
- - 1.6.6
873
-
874
- - Add warm/cold color function
875
-
876
- - 1.6.5
877
-
878
- - Really, really make `init_from` work, by allowingly allowing allowed attributes
879
-
880
- - 1.6.4
881
-
882
- - Fix bug where `init_from` would sometime duplicate data.
883
- - Make sure `init_from` does not overwrite class methods.
884
-
885
- - 1.6.3
886
-
887
- - Protect private properties from being overwritten by `init_from`
888
- - When `units` is count, `decimal` should default to 0 if not provided. This sometimes didn't work. Now it does.
889
-
890
- - 1.6.2
891
-
892
- - Make `init_from` work as expected with a language argument
893
-
894
- - 1.6.1
895
-
896
- - Make `init_from` work as expected with multiple data series
897
-
898
- - 1.6.0
899
-
900
- - Added a factory method to create charts from a JSON-like Python object, like so: `SerialChart.init_from(config, storage)`
901
-
902
- - 1.5.1
903
-
904
- - Fix packaging error in 1.5.0
905
-
906
- - 1.5.0
907
-
908
- - Expose available chart engines in `CHART_ENGINES` constant for dynamic loading
909
- - Add `color_fn` property, for coloring bars based on value
910
- - Increase line width in default style
911
- - Upgrading Numpy could potentially affect how infinity is treated in serial charts.
912
-
913
- - 1.4.1
914
-
915
- - Revert text adjusting for categorical charts, as it had issues
916
-
917
- - 1.4.0
918
-
919
- - Add new ScatterPlot chart class
920
- - Improved text adjusting in serial charts
921
- - More secure YAML file parsing
922
-
923
- - 1.3.3
924
-
925
- - Make small bar charts with very many bars look better
926
-
927
- - 1.3.2
928
-
929
- - Make labels work again, 1.3.1 broke those in some circumstances
930
-
931
- - 1.3.1
932
-
933
- - Make inner_max/min_x work with leading / trailing None values
934
- - Make sure single, orphaned values are visible (as points) in line charts
935
-
936
- - 1.3.0
937
-
938
- - Allow (and recommend) using Matplotlib 3. This may affect how some charts are rendered.
939
- - Removed undocumented and incomplete Latex support from caption.
940
- - Don't highlight diff outside either series' extreme ends.
941
-
942
- - 1.2.1
943
-
944
- - Use strong color if there is nothing to highlight.
945
-
946
- - 1.2.0
947
-
948
- - Fix a bug where `decimals` setting was not used in all annotations. Potentially breaking in some implementations.
949
- - Make the annotation offset 80% of the fontsize (used to be a hardcoded number of pixels)
950
-
951
- - 1.1.5
952
-
953
- - Small cosmetic update: Decrease offset of annotation.
954
-
955
- - 1.1.4
956
-
957
- - Require Matplotlib < 3, because we are still relying on some features that are deprecated there. Also, internal changes to Matplot lib may cause some charts to look different depending on version.
958
-
959
- - 1.1.3
960
-
961
- - Make annotation use default font size, as relative sizing didn't work here anyway
962
-
963
- - 1.1.2
964
-
965
- - Move class properties to method properties to make sure multiple Chart instances work as intended/documented. This will make tests run again.
966
- - None values in bar charts are not annotated (trying to annotate None values used to result in a crash)
967
- - More tests
968
-
969
- - 1.1.1
970
-
971
- - Annotations should now work as expected on series with missing data
972
-
973
- - 1.1.0
974
-
975
- - Fix bug where decimal setting wasn't always respected
976
- - Make no decimals the default if unit is "count"
977
-
978
- - 1.0.0
979
-
980
- - First version