newsworthycharts 1.71.5__tar.gz → 1.72.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.71.5/newsworthycharts.egg-info → newsworthycharts-1.72.0}/PKG-INFO +12 -3
- {newsworthycharts-1.71.5 → newsworthycharts-1.72.0}/README.rst +9 -0
- {newsworthycharts-1.71.5 → newsworthycharts-1.72.0}/newsworthycharts/__init__.py +1 -1
- {newsworthycharts-1.71.5 → newsworthycharts-1.72.0}/newsworthycharts/choroplethmap.py +31 -2
- {newsworthycharts-1.71.5 → newsworthycharts-1.72.0}/newsworthycharts/map.py +1 -0
- {newsworthycharts-1.71.5 → newsworthycharts-1.72.0}/newsworthycharts/rankchart.py +8 -2
- {newsworthycharts-1.71.5 → newsworthycharts-1.72.0}/newsworthycharts/serialchart.py +2 -1
- {newsworthycharts-1.71.5 → newsworthycharts-1.72.0/newsworthycharts.egg-info}/PKG-INFO +12 -3
- {newsworthycharts-1.71.5 → newsworthycharts-1.72.0}/newsworthycharts.egg-info/requires.txt +1 -1
- {newsworthycharts-1.71.5 → newsworthycharts-1.72.0}/setup.py +1 -1
- {newsworthycharts-1.71.5 → newsworthycharts-1.72.0}/LICENSE.txt +0 -0
- {newsworthycharts-1.71.5 → newsworthycharts-1.72.0}/MANIFEST.in +0 -0
- {newsworthycharts-1.71.5 → newsworthycharts-1.72.0}/newsworthycharts/bubblemap.py +0 -0
- {newsworthycharts-1.71.5 → newsworthycharts-1.72.0}/newsworthycharts/categoricalchart.py +0 -0
- {newsworthycharts-1.71.5 → newsworthycharts-1.72.0}/newsworthycharts/chart.py +0 -0
- {newsworthycharts-1.71.5 → newsworthycharts-1.72.0}/newsworthycharts/custom/__init__.py +0 -0
- {newsworthycharts-1.71.5 → newsworthycharts-1.72.0}/newsworthycharts/custom/climate_cars.py +0 -0
- {newsworthycharts-1.71.5 → newsworthycharts-1.72.0}/newsworthycharts/datawrapper.py +0 -0
- {newsworthycharts-1.71.5 → newsworthycharts-1.72.0}/newsworthycharts/lib/__init__.py +0 -0
- {newsworthycharts-1.71.5 → newsworthycharts-1.72.0}/newsworthycharts/lib/color_fn.py +0 -0
- {newsworthycharts-1.71.5 → newsworthycharts-1.72.0}/newsworthycharts/lib/colors.py +0 -0
- {newsworthycharts-1.71.5 → newsworthycharts-1.72.0}/newsworthycharts/lib/datalist.py +0 -0
- {newsworthycharts-1.71.5 → newsworthycharts-1.72.0}/newsworthycharts/lib/formatter.py +0 -0
- {newsworthycharts-1.71.5 → newsworthycharts-1.72.0}/newsworthycharts/lib/geography.py +0 -0
- {newsworthycharts-1.71.5 → newsworthycharts-1.72.0}/newsworthycharts/lib/locator.py +0 -0
- {newsworthycharts-1.71.5 → newsworthycharts-1.72.0}/newsworthycharts/lib/mimetypes.py +0 -0
- {newsworthycharts-1.71.5 → newsworthycharts-1.72.0}/newsworthycharts/lib/utils.py +0 -0
- {newsworthycharts-1.71.5 → newsworthycharts-1.72.0}/newsworthycharts/maps/se-4.gpkg +0 -0
- {newsworthycharts-1.71.5 → newsworthycharts-1.72.0}/newsworthycharts/maps/se-7.gpkg +0 -0
- {newsworthycharts-1.71.5 → newsworthycharts-1.72.0}/newsworthycharts/rangeplot.py +0 -0
- {newsworthycharts-1.71.5 → newsworthycharts-1.72.0}/newsworthycharts/rc/newsworthy +0 -0
- {newsworthycharts-1.71.5 → newsworthycharts-1.72.0}/newsworthycharts/scatterplot.py +0 -0
- {newsworthycharts-1.71.5 → newsworthycharts-1.72.0}/newsworthycharts/seasonalchart.py +0 -0
- {newsworthycharts-1.71.5 → newsworthycharts-1.72.0}/newsworthycharts/storage.py +0 -0
- {newsworthycharts-1.71.5 → newsworthycharts-1.72.0}/newsworthycharts/stripechart.py +0 -0
- {newsworthycharts-1.71.5 → newsworthycharts-1.72.0}/newsworthycharts/translations/datawrapper_regions.csv +0 -0
- {newsworthycharts-1.71.5 → newsworthycharts-1.72.0}/newsworthycharts/translations/regions.py +0 -0
- {newsworthycharts-1.71.5 → newsworthycharts-1.72.0}/newsworthycharts/translations/se_municipalities.csv +0 -0
- {newsworthycharts-1.71.5 → newsworthycharts-1.72.0}/newsworthycharts.egg-info/SOURCES.txt +0 -0
- {newsworthycharts-1.71.5 → newsworthycharts-1.72.0}/newsworthycharts.egg-info/dependency_links.txt +0 -0
- {newsworthycharts-1.71.5 → newsworthycharts-1.72.0}/newsworthycharts.egg-info/not-zip-safe +0 -0
- {newsworthycharts-1.71.5 → newsworthycharts-1.72.0}/newsworthycharts.egg-info/top_level.txt +0 -0
- {newsworthycharts-1.71.5 → newsworthycharts-1.72.0}/setup.cfg +0 -0
- {newsworthycharts-1.71.5 → newsworthycharts-1.72.0}/test/test_categorical_chart.py +0 -0
- {newsworthycharts-1.71.5 → newsworthycharts-1.72.0}/test/test_choropleth_maps.py +0 -0
- {newsworthycharts-1.71.5 → newsworthycharts-1.72.0}/test/test_custom_climate_cars.py +0 -0
- {newsworthycharts-1.71.5 → newsworthycharts-1.72.0}/test/test_data_list.py +0 -0
- {newsworthycharts-1.71.5 → newsworthycharts-1.72.0}/test/test_datawrapper.py +0 -0
- {newsworthycharts-1.71.5 → newsworthycharts-1.72.0}/test/test_main.py +0 -0
- {newsworthycharts-1.71.5 → newsworthycharts-1.72.0}/test/test_rangeplot.py +0 -0
- {newsworthycharts-1.71.5 → newsworthycharts-1.72.0}/test/test_scatterplot.py +0 -0
- {newsworthycharts-1.71.5 → newsworthycharts-1.72.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.72.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.72.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
|
@@ -11,7 +11,7 @@ Requires-Python: >=3.9
|
|
11
11
|
Description-Content-Type: text/x-rst
|
12
12
|
License-File: LICENSE.txt
|
13
13
|
Requires-Dist: boto3>=1.26
|
14
|
-
Requires-Dist: matplotlib==3.10.
|
14
|
+
Requires-Dist: matplotlib==3.10.1
|
15
15
|
Requires-Dist: langcodes>=3.3
|
16
16
|
Requires-Dist: Babel<3,>=2.14.0
|
17
17
|
Requires-Dist: PyYAML>=3
|
@@ -271,6 +271,15 @@ Roadmap
|
|
271
271
|
Changelog
|
272
272
|
---------
|
273
273
|
|
274
|
+
- 1.72.0
|
275
|
+
|
276
|
+
- Use gradient legend för continuous choropleth maps
|
277
|
+
- Don't add None value to legend if it is empty in ChoroplethMap
|
278
|
+
- Fixed zorder bug in SerialChart with baseline annotations and bars
|
279
|
+
- matplotlib==3.10.1
|
280
|
+
- Fixed a bug where choropleth maps would break on svery small numbers (by bypassing all axis formatting logic for maps).
|
281
|
+
This should also speed up rendering of maps somewhat.
|
282
|
+
|
274
283
|
- 1.71.5
|
275
284
|
|
276
285
|
- zorder fixes in BumpChart
|
@@ -245,6 +245,15 @@ Roadmap
|
|
245
245
|
Changelog
|
246
246
|
---------
|
247
247
|
|
248
|
+
- 1.72.0
|
249
|
+
|
250
|
+
- Use gradient legend för continuous choropleth maps
|
251
|
+
- Don't add None value to legend if it is empty in ChoroplethMap
|
252
|
+
- Fixed zorder bug in SerialChart with baseline annotations and bars
|
253
|
+
- matplotlib==3.10.1
|
254
|
+
- Fixed a bug where choropleth maps would break on svery small numbers (by bypassing all axis formatting logic for maps).
|
255
|
+
This should also speed up rendering of maps somewhat.
|
256
|
+
|
248
257
|
- 1.71.5
|
249
258
|
|
250
259
|
- zorder fixes in BumpChart
|
@@ -8,6 +8,7 @@ import pandas as pd
|
|
8
8
|
import mapclassify
|
9
9
|
import matplotlib as mpl
|
10
10
|
import matplotlib.patches as mpatches
|
11
|
+
from mpl_toolkits.axes_grid1.inset_locator import inset_axes
|
11
12
|
|
12
13
|
|
13
14
|
class ChoroplethMap(Map):
|
@@ -61,6 +62,32 @@ class ChoroplethMap(Map):
|
|
61
62
|
df["color"] = df["color"].fillna("gainsboro")
|
62
63
|
args["color"] = df["color"]
|
63
64
|
|
65
|
+
self._fig.tight_layout()
|
66
|
+
fmt = self._get_value_axis_formatter()
|
67
|
+
cax = inset_axes(
|
68
|
+
self.ax,
|
69
|
+
width=0.1,
|
70
|
+
height=2, # 2 tum = 200 px vid 100 dpi
|
71
|
+
loc='upper right',
|
72
|
+
borderpad=0.1,
|
73
|
+
# formatter
|
74
|
+
)
|
75
|
+
cb = self._fig.colorbar(
|
76
|
+
mapper,
|
77
|
+
cax=cax,
|
78
|
+
format=mpl.ticker.FuncFormatter(fmt),
|
79
|
+
drawedges=False,
|
80
|
+
shrink=0.9,
|
81
|
+
# use_gridspec=False,
|
82
|
+
# pad=0.1,
|
83
|
+
)
|
84
|
+
# args["legend_kwds"]["pad"] = 0.15
|
85
|
+
# args["legend_kwds"]["location"] = "left"
|
86
|
+
|
87
|
+
if self.legend_title:
|
88
|
+
cb.set_label(self.legend_title)
|
89
|
+
self.legend_title = None
|
90
|
+
"""
|
64
91
|
_min = df["data"].min()
|
65
92
|
_max = df["data"].max()
|
66
93
|
_median = df["data"].median()
|
@@ -70,6 +97,7 @@ class ChoroplethMap(Map):
|
|
70
97
|
patches.append(mpatches.Patch(color=mapper.to_rgba(_median), label=fmt(_median)))
|
71
98
|
if _max != _min:
|
72
99
|
patches.append(mpatches.Patch(color=mapper.to_rgba(_max), label=fmt(_max)))
|
100
|
+
"""
|
73
101
|
|
74
102
|
elif not self.categorical:
|
75
103
|
# mapclassify doesn't work well with nan values,
|
@@ -99,7 +127,7 @@ class ChoroplethMap(Map):
|
|
99
127
|
# args["cmap"] = self.color_ramp
|
100
128
|
# We can not provide vmin/vmax to geopandas, so we need to
|
101
129
|
# normalize the data ourselves, otherwise the inset maps will be off
|
102
|
-
norm = mpl.colors.Normalize(vmin=
|
130
|
+
norm = mpl.colors.Normalize(vmin=_has_value["data"].min(), vmax=_has_value["data"].max())
|
103
131
|
mapper = mpl.cm.ScalarMappable(norm=norm, cmap=self.color_ramp)
|
104
132
|
df["color"] = df["data"].apply(lambda x: mapper.to_rgba(x) if not np.isnan(x) else "gainsboro")
|
105
133
|
df["color"] = df["color"].fillna("gainsboro")
|
@@ -155,7 +183,7 @@ class ChoroplethMap(Map):
|
|
155
183
|
patch = mpatches.Patch(color=color, label=label)
|
156
184
|
patches.append(patch)
|
157
185
|
patches = list(reversed(patches))
|
158
|
-
if self.missing_label:
|
186
|
+
if self.missing_label and len(patches):
|
159
187
|
patches.append(mpatches.Patch(color="gainsboro", label=self.missing_label))
|
160
188
|
|
161
189
|
df.plot(ax=self.ax, **args)
|
@@ -201,3 +229,4 @@ class ChoroplethMap(Map):
|
|
201
229
|
handles=patches,
|
202
230
|
**label_kwargs,
|
203
231
|
)
|
232
|
+
#self.ax.get_figure().savefig("TST.png", bbox_inches="tight")
|
@@ -148,9 +148,15 @@ class BumpChart(SerialChart):
|
|
148
148
|
# To save time we'll only measure the with of the longest text string
|
149
149
|
# There will be edge cases where shorter strings taker up more space
|
150
150
|
longest_sp_label = max([len(str(x[1])) for x in startpoints])
|
151
|
-
dummy_text = self.ax.text(
|
151
|
+
dummy_text = self.ax.text(
|
152
|
+
0, 0,
|
153
|
+
longest_sp_label,
|
154
|
+
fontsize=self._nwc_style["annotation.fontsize"]
|
155
|
+
)
|
152
156
|
_bbox = dummy_text.get_window_extent(renderer=self._fig.canvas.get_renderer())
|
153
|
-
self.ax.spines['left'].set_position(
|
157
|
+
self.ax.spines['left'].set_position(
|
158
|
+
('outward', _bbox.width * 1.15 + 15)
|
159
|
+
)
|
154
160
|
dummy_text.remove()
|
155
161
|
|
156
162
|
if self.label_placement in ["right", "both"]:
|
@@ -520,7 +520,7 @@ class SerialChart(Chart):
|
|
520
520
|
linewidth=1,
|
521
521
|
color="#444444",
|
522
522
|
zorder=11,
|
523
|
-
linestyle="--" if self.baseline else "-"
|
523
|
+
linestyle="--" if self.baseline else "-",
|
524
524
|
)
|
525
525
|
if self.baseline_annotation:
|
526
526
|
xy = (to_date(self.data.outer_min_x), self.baseline)
|
@@ -531,6 +531,7 @@ class SerialChart(Chart):
|
|
531
531
|
xy,
|
532
532
|
direction="down" if first_val and first_val >= self.baseline else "up",
|
533
533
|
color=self._nwc_style["neutral_color"],
|
534
|
+
zorder=11,
|
534
535
|
)
|
535
536
|
|
536
537
|
# Shade area between lines if there are exactly 2 series
|
@@ -1,9 +1,9 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: newsworthycharts
|
3
|
-
Version: 1.
|
3
|
+
Version: 1.72.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.72.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
|
@@ -11,7 +11,7 @@ Requires-Python: >=3.9
|
|
11
11
|
Description-Content-Type: text/x-rst
|
12
12
|
License-File: LICENSE.txt
|
13
13
|
Requires-Dist: boto3>=1.26
|
14
|
-
Requires-Dist: matplotlib==3.10.
|
14
|
+
Requires-Dist: matplotlib==3.10.1
|
15
15
|
Requires-Dist: langcodes>=3.3
|
16
16
|
Requires-Dist: Babel<3,>=2.14.0
|
17
17
|
Requires-Dist: PyYAML>=3
|
@@ -271,6 +271,15 @@ Roadmap
|
|
271
271
|
Changelog
|
272
272
|
---------
|
273
273
|
|
274
|
+
- 1.72.0
|
275
|
+
|
276
|
+
- Use gradient legend för continuous choropleth maps
|
277
|
+
- Don't add None value to legend if it is empty in ChoroplethMap
|
278
|
+
- Fixed zorder bug in SerialChart with baseline annotations and bars
|
279
|
+
- matplotlib==3.10.1
|
280
|
+
- Fixed a bug where choropleth maps would break on svery small numbers (by bypassing all axis formatting logic for maps).
|
281
|
+
This should also speed up rendering of maps somewhat.
|
282
|
+
|
274
283
|
- 1.71.5
|
275
284
|
|
276
285
|
- zorder fixes in BumpChart
|
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.71.5 → newsworthycharts-1.72.0}/newsworthycharts/translations/regions.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
{newsworthycharts-1.71.5 → newsworthycharts-1.72.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
|