newsworthycharts 1.58.0__tar.gz → 1.59.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.58.0/newsworthycharts.egg-info → newsworthycharts-1.59.0}/PKG-INFO +7 -2
- {newsworthycharts-1.58.0 → newsworthycharts-1.59.0}/README.rst +5 -0
- {newsworthycharts-1.58.0 → newsworthycharts-1.59.0}/newsworthycharts/__init__.py +1 -1
- {newsworthycharts-1.58.0 → newsworthycharts-1.59.0}/newsworthycharts/chart.py +18 -9
- {newsworthycharts-1.58.0 → newsworthycharts-1.59.0}/newsworthycharts/serialchart.py +27 -26
- {newsworthycharts-1.58.0 → newsworthycharts-1.59.0/newsworthycharts.egg-info}/PKG-INFO +7 -2
- {newsworthycharts-1.58.0 → newsworthycharts-1.59.0}/LICENSE.txt +0 -0
- {newsworthycharts-1.58.0 → newsworthycharts-1.59.0}/MANIFEST.in +0 -0
- {newsworthycharts-1.58.0 → newsworthycharts-1.59.0}/newsworthycharts/bubblemap.py +0 -0
- {newsworthycharts-1.58.0 → newsworthycharts-1.59.0}/newsworthycharts/categoricalchart.py +0 -0
- {newsworthycharts-1.58.0 → newsworthycharts-1.59.0}/newsworthycharts/choroplethmap.py +0 -0
- {newsworthycharts-1.58.0 → newsworthycharts-1.59.0}/newsworthycharts/custom/__init__.py +0 -0
- {newsworthycharts-1.58.0 → newsworthycharts-1.59.0}/newsworthycharts/custom/climate_cars.py +0 -0
- {newsworthycharts-1.58.0 → newsworthycharts-1.59.0}/newsworthycharts/datawrapper.py +0 -0
- {newsworthycharts-1.58.0 → newsworthycharts-1.59.0}/newsworthycharts/lib/__init__.py +0 -0
- {newsworthycharts-1.58.0 → newsworthycharts-1.59.0}/newsworthycharts/lib/color_fn.py +0 -0
- {newsworthycharts-1.58.0 → newsworthycharts-1.59.0}/newsworthycharts/lib/colors.py +0 -0
- {newsworthycharts-1.58.0 → newsworthycharts-1.59.0}/newsworthycharts/lib/datalist.py +0 -0
- {newsworthycharts-1.58.0 → newsworthycharts-1.59.0}/newsworthycharts/lib/formatter.py +0 -0
- {newsworthycharts-1.58.0 → newsworthycharts-1.59.0}/newsworthycharts/lib/geography.py +0 -0
- {newsworthycharts-1.58.0 → newsworthycharts-1.59.0}/newsworthycharts/lib/locator.py +0 -0
- {newsworthycharts-1.58.0 → newsworthycharts-1.59.0}/newsworthycharts/lib/mimetypes.py +0 -0
- {newsworthycharts-1.58.0 → newsworthycharts-1.59.0}/newsworthycharts/lib/utils.py +0 -0
- {newsworthycharts-1.58.0 → newsworthycharts-1.59.0}/newsworthycharts/map.py +0 -0
- {newsworthycharts-1.58.0 → newsworthycharts-1.59.0}/newsworthycharts/maps/se-4.gpkg +0 -0
- {newsworthycharts-1.58.0 → newsworthycharts-1.59.0}/newsworthycharts/maps/se-7.gpkg +0 -0
- {newsworthycharts-1.58.0 → newsworthycharts-1.59.0}/newsworthycharts/rangeplot.py +0 -0
- {newsworthycharts-1.58.0 → newsworthycharts-1.59.0}/newsworthycharts/rc/newsworthy +0 -0
- {newsworthycharts-1.58.0 → newsworthycharts-1.59.0}/newsworthycharts/scatterplot.py +0 -0
- {newsworthycharts-1.58.0 → newsworthycharts-1.59.0}/newsworthycharts/seasonalchart.py +0 -0
- {newsworthycharts-1.58.0 → newsworthycharts-1.59.0}/newsworthycharts/storage.py +0 -0
- {newsworthycharts-1.58.0 → newsworthycharts-1.59.0}/newsworthycharts/stripechart.py +0 -0
- {newsworthycharts-1.58.0 → newsworthycharts-1.59.0}/newsworthycharts/translations/datawrapper_regions.csv +0 -0
- {newsworthycharts-1.58.0 → newsworthycharts-1.59.0}/newsworthycharts/translations/regions.py +0 -0
- {newsworthycharts-1.58.0 → newsworthycharts-1.59.0}/newsworthycharts/translations/se_municipalities.csv +0 -0
- {newsworthycharts-1.58.0 → newsworthycharts-1.59.0}/newsworthycharts.egg-info/SOURCES.txt +0 -0
- {newsworthycharts-1.58.0 → newsworthycharts-1.59.0}/newsworthycharts.egg-info/dependency_links.txt +0 -0
- {newsworthycharts-1.58.0 → newsworthycharts-1.59.0}/newsworthycharts.egg-info/not-zip-safe +0 -0
- {newsworthycharts-1.58.0 → newsworthycharts-1.59.0}/newsworthycharts.egg-info/requires.txt +0 -0
- {newsworthycharts-1.58.0 → newsworthycharts-1.59.0}/newsworthycharts.egg-info/top_level.txt +0 -0
- {newsworthycharts-1.58.0 → newsworthycharts-1.59.0}/setup.cfg +0 -0
- {newsworthycharts-1.58.0 → newsworthycharts-1.59.0}/setup.py +0 -0
- {newsworthycharts-1.58.0 → newsworthycharts-1.59.0}/test/test_categorical_chart.py +0 -0
- {newsworthycharts-1.58.0 → newsworthycharts-1.59.0}/test/test_choropleth_maps.py +0 -0
- {newsworthycharts-1.58.0 → newsworthycharts-1.59.0}/test/test_custom_climate_cars.py +0 -0
- {newsworthycharts-1.58.0 → newsworthycharts-1.59.0}/test/test_data_list.py +0 -0
- {newsworthycharts-1.58.0 → newsworthycharts-1.59.0}/test/test_datawrapper.py +0 -0
- {newsworthycharts-1.58.0 → newsworthycharts-1.59.0}/test/test_main.py +0 -0
- {newsworthycharts-1.58.0 → newsworthycharts-1.59.0}/test/test_rangeplot.py +0 -0
- {newsworthycharts-1.58.0 → newsworthycharts-1.59.0}/test/test_scatterplot.py +0 -0
- {newsworthycharts-1.58.0 → newsworthycharts-1.59.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.59.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.59.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
|
@@ -132,6 +132,7 @@ These settings are available for all chart types:
|
|
132
132
|
- ylabel = None
|
133
133
|
- caption = None
|
134
134
|
- highlight = A position (typically a date, category label or index) to highlight. The semantics may differ somewhat between chart types.
|
135
|
+
- highlight_annotation = True # Print out values at highlighted point?
|
135
136
|
- decimals = None # None means automatically chose the best number
|
136
137
|
- logo = None # Path to image that will be embedded in the caption area. Can also be set though a style property
|
137
138
|
- color_fn = None # Custom coloring function
|
@@ -229,6 +230,10 @@ Roadmap
|
|
229
230
|
Changelog
|
230
231
|
---------
|
231
232
|
|
233
|
+
- 1.59.0
|
234
|
+
|
235
|
+
- Added `.highlight_annotation` to enable turning off the textual annotation on the highlighted point
|
236
|
+
|
232
237
|
- 1.58.0
|
233
238
|
|
234
239
|
- Matplotlib==3.9
|
@@ -119,6 +119,7 @@ These settings are available for all chart types:
|
|
119
119
|
- ylabel = None
|
120
120
|
- caption = None
|
121
121
|
- highlight = A position (typically a date, category label or index) to highlight. The semantics may differ somewhat between chart types.
|
122
|
+
- highlight_annotation = True # Print out values at highlighted point?
|
122
123
|
- decimals = None # None means automatically chose the best number
|
123
124
|
- logo = None # Path to image that will be embedded in the caption area. Can also be set though a style property
|
124
125
|
- color_fn = None # Custom coloring function
|
@@ -216,6 +217,10 @@ Roadmap
|
|
216
217
|
Changelog
|
217
218
|
---------
|
218
219
|
|
220
|
+
- 1.59.0
|
221
|
+
|
222
|
+
- Added `.highlight_annotation` to enable turning off the textual annotation on the highlighted point
|
223
|
+
|
219
224
|
- 1.58.0
|
220
225
|
|
221
226
|
- Matplotlib==3.9
|
@@ -61,6 +61,7 @@ class Chart(object):
|
|
61
61
|
self.ylabel = None
|
62
62
|
self.caption = None
|
63
63
|
self.highlight = None
|
64
|
+
self.highlight_annotation = True
|
64
65
|
self.decimals = None
|
65
66
|
self.yline = None
|
66
67
|
self.type = None
|
@@ -259,10 +260,15 @@ class Chart(object):
|
|
259
260
|
hextent = (0, self._w)
|
260
261
|
self._set_size(hextent[1] - hextent[0])
|
261
262
|
x1 = hextent[0] / self._w
|
262
|
-
text = self._fig.text(
|
263
|
-
|
264
|
-
|
265
|
-
|
263
|
+
text = self._fig.text(
|
264
|
+
x1,
|
265
|
+
0.01,
|
266
|
+
caption,
|
267
|
+
in_layout=True,
|
268
|
+
color=self._nwc_style["neutral_color"],
|
269
|
+
wrap=True,
|
270
|
+
fontsize=self._nwc_style["caption.fontsize"],
|
271
|
+
)
|
266
272
|
self._fig.canvas.draw()
|
267
273
|
wrapped_text = text._get_wrapped_text()
|
268
274
|
text.set_text(wrapped_text)
|
@@ -272,11 +278,14 @@ class Chart(object):
|
|
272
278
|
|
273
279
|
def _add_title(self, title_text):
|
274
280
|
"""Add a title."""
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
281
|
+
text = self._fig.suptitle(
|
282
|
+
title_text, wrap=True,
|
283
|
+
x=0,
|
284
|
+
y=0.985, # default: 0.98
|
285
|
+
horizontalalignment="left",
|
286
|
+
multialignment="left",
|
287
|
+
fontproperties=self._title_font,
|
288
|
+
)
|
280
289
|
|
281
290
|
self._title_elem = text
|
282
291
|
|
@@ -409,35 +409,36 @@ class SerialChart(Chart):
|
|
409
409
|
self.ax.legend(handles=patches)
|
410
410
|
|
411
411
|
# Annotate highlighted points/bars
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
if
|
417
|
-
|
418
|
-
else:
|
419
|
-
dir = "down"
|
420
|
-
if self.type[i] == "line":
|
421
|
-
if len(highlight_values) > 1:
|
422
|
-
# When highlighting two values on the same point,
|
423
|
-
# put them in opposite direction
|
424
|
-
if hv == max(highlight_values):
|
412
|
+
if self.highlight_annotation:
|
413
|
+
for hv in highlight_values:
|
414
|
+
value_label = a_formatter(hv)
|
415
|
+
xy = (highlight_date, hv)
|
416
|
+
if self.type[i] == "bars":
|
417
|
+
if hv >= self.baseline:
|
425
418
|
dir = "up"
|
426
|
-
elif hv == min(highlight_values):
|
427
|
-
dir = "down"
|
428
419
|
else:
|
429
|
-
dir = "
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
420
|
+
dir = "down"
|
421
|
+
if self.type[i] == "line":
|
422
|
+
if len(highlight_values) > 1:
|
423
|
+
# When highlighting two values on the same point,
|
424
|
+
# put them in opposite direction
|
425
|
+
if hv == max(highlight_values):
|
426
|
+
dir = "up"
|
427
|
+
elif hv == min(highlight_values):
|
428
|
+
dir = "down"
|
429
|
+
else:
|
430
|
+
dir = "left" # To the right we have diff annotation
|
435
431
|
else:
|
436
|
-
#
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
432
|
+
# Otherwise, use what works best with the line shape
|
433
|
+
if highlight_date in dates:
|
434
|
+
i = dates.index(highlight_date)
|
435
|
+
dir = self._get_annotation_direction(i, values)
|
436
|
+
else:
|
437
|
+
# This highlight is probably out of range for this dataset
|
438
|
+
# Could happen if we have two or more lines,
|
439
|
+
# with different start and end points.
|
440
|
+
continue
|
441
|
+
self._annotate_point(value_label, xy, direction=dir)
|
441
442
|
|
442
443
|
# Add background highlights
|
443
444
|
for (x0, x1) in self.highlighted_x_ranges:
|
@@ -1,9 +1,9 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: newsworthycharts
|
3
|
-
Version: 1.
|
3
|
+
Version: 1.59.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.59.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
|
@@ -132,6 +132,7 @@ These settings are available for all chart types:
|
|
132
132
|
- ylabel = None
|
133
133
|
- caption = None
|
134
134
|
- highlight = A position (typically a date, category label or index) to highlight. The semantics may differ somewhat between chart types.
|
135
|
+
- highlight_annotation = True # Print out values at highlighted point?
|
135
136
|
- decimals = None # None means automatically chose the best number
|
136
137
|
- logo = None # Path to image that will be embedded in the caption area. Can also be set though a style property
|
137
138
|
- color_fn = None # Custom coloring function
|
@@ -229,6 +230,10 @@ Roadmap
|
|
229
230
|
Changelog
|
230
231
|
---------
|
231
232
|
|
233
|
+
- 1.59.0
|
234
|
+
|
235
|
+
- Added `.highlight_annotation` to enable turning off the textual annotation on the highlighted point
|
236
|
+
|
232
237
|
- 1.58.0
|
233
238
|
|
234
239
|
- Matplotlib==3.9
|
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
|
File without changes
|
{newsworthycharts-1.58.0 → newsworthycharts-1.59.0}/newsworthycharts/translations/regions.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
{newsworthycharts-1.58.0 → newsworthycharts-1.59.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
|
File without changes
|
File without changes
|
File without changes
|