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