newsworthycharts 1.65.3__py3-none-any.whl → 1.66.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.65.3"
1
+ __version__ = "1.66.0"
2
2
 
3
3
  from .chart import Chart
4
4
  from .choroplethmap import ChoroplethMap
@@ -25,32 +25,39 @@ class CategoricalChart(Chart):
25
25
  return self.stacked
26
26
 
27
27
  def _add_pie_data(self):
28
- if len(self.data) > 1:
29
- raise ValueError("Pie chart takes one data series only.")
30
28
  self.legend = False
31
29
  self.show_ticks = False
32
30
 
33
- data = self.data[0]
34
- values = [to_float(x[1]) for x in data]
35
- labels = [x[0] for x in data]
36
-
37
- if self.colors is not None:
38
- colors = self.colors
39
- else:
40
- colors = [self._nwc_style["qualitative_colors"][i] for i in range(len(values))]
31
+ if len(self.data) > 1:
32
+ subaxes = self._fig.subplots(1, len(self.data))
33
+ for idx, serie in enumerate(self.data):
34
+ if len(self.data) == 1:
35
+ subax = self.ax
36
+ else:
37
+ subax = subaxes[idx]
41
38
 
42
- explode = [0.1 if x == self.highlight else 0 for x in labels]
39
+ values = [to_float(x[1]) for x in serie]
40
+ labels = [x[0] for x in serie]
43
41
 
44
- self.ax.pie(
45
- values,
46
- labels=labels,
47
- startangle=90,
48
- colors=colors,
49
- explode=explode
50
- )
51
- self.ax.axis('equal')
42
+ if self.colors is not None:
43
+ colors = self.colors
44
+ else:
45
+ colors = [self._nwc_style["qualitative_colors"][i] for i in range(len(values))]
46
+
47
+ explode = [0.1 if x == self.highlight else 0 for x in labels]
48
+ subax.pie(
49
+ values,
50
+ labels=labels,
51
+ startangle=90,
52
+ colors=colors,
53
+ explode=explode
54
+ )
55
+ subax.axis('equal')
56
+ # `labels` in pie charts are used to label the series, not the values
57
+ if self.labels:
58
+ subax.set_title(self.labels[idx], loc='center', y=0.04)
52
59
 
53
- self._setup_legend()
60
+ self.ax.axis('off')
54
61
 
55
62
  def _add_data(self):
56
63
  if self.type == "pie":
@@ -339,7 +346,7 @@ class ProgressChart(CategoricalChart):
339
346
 
340
347
  # rect.set_linewidth(1)
341
348
  # rect.set_edgecolor(color_progress)
342
-
349
+
343
350
  # LABELING: Target
344
351
  if self.target_label:
345
352
  offset = 25
newsworthycharts/chart.py CHANGED
@@ -856,7 +856,7 @@ class Chart(object):
856
856
  if self._subtitle_elem:
857
857
  rel_height += self._text_rel_height(self._subtitle_elem)
858
858
  # Adds a fixed margin below
859
- rel_height += 0.008
859
+ rel_height += 0.012
860
860
  # rel_height += 15 / self._h
861
861
  return rel_height
862
862
 
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: newsworthycharts
3
- Version: 1.65.3
3
+ Version: 1.66.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.65.3.tar.gz
6
+ Download-URL: https://github.com/jplusplus/newsworthycharts/archive/1.66.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
@@ -259,6 +259,15 @@ Roadmap
259
259
  Changelog
260
260
  ---------
261
261
 
262
+ - 1.66.0
263
+
264
+ - Support multiple data series in pie charts (displayed as small multiples)
265
+
266
+
267
+ - 1.65.4
268
+
269
+ - Revert some of the title margin changes
270
+
262
271
  - 1.65.3
263
272
 
264
273
  - Dynamic title font size adjustments
@@ -1,7 +1,7 @@
1
- newsworthycharts/__init__.py,sha256=ODCtHqJexpBEQZZc3IXGci1BSm9InC4RbbjH4T0gNgo,1160
1
+ newsworthycharts/__init__.py,sha256=dPnI3-O29XlaYmTwMFQBa7XfStx-E5cEUxSrGXbB8iw,1160
2
2
  newsworthycharts/bubblemap.py,sha256=nkocWmpiFgfjEuJGAsthjY5X7Q56jXWsZHUGXw4PwgE,2587
3
- newsworthycharts/categoricalchart.py,sha256=wLrS8H69Sx3FT-0r3w3ZOIC83IHb8HCHD0zTsXiIiNA,15737
4
- newsworthycharts/chart.py,sha256=uXMjIM33DHpHSabQcodc-wniKJ0AaSTrtY9UavC8EUU,34374
3
+ newsworthycharts/categoricalchart.py,sha256=iU0itO0_wTxXP_ebp_2mq0hxTYiPqM23BX1dDouLUhA,16101
4
+ newsworthycharts/chart.py,sha256=FEQRAvdfX0x3KWFBxFEpGhh3w6dRMX5dTw-VIFPo4jA,34374
5
5
  newsworthycharts/choroplethmap.py,sha256=bCLf4kcchp1C2djg5AxcOM8BdbaMj0xg7UHrZsDafhI,8013
6
6
  newsworthycharts/datawrapper.py,sha256=RRkAVTpfP4updKxUIBaSmKuBi2RUVPaBRF8HDQhlGGA,11250
7
7
  newsworthycharts/map.py,sha256=c409jEO4L8Yr780sJRC0RchR44roAlgOUDAkuk1SfRg,6057
@@ -28,8 +28,8 @@ newsworthycharts/rc/newsworthy,sha256=yOIZvYS6PG1u19VMcdtfj9vbihKQsey5IprwqK59Kg
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.65.3.dist-info/LICENSE.txt,sha256=Sq6kGICrehbhC_FolNdXf0djKjTpv3YqjFCIYsxdQN4,1069
32
- newsworthycharts-1.65.3.dist-info/METADATA,sha256=4dOLUm5Cvev74zXZek-hHMdY2aZQLt6tQoUjvJACEmo,30850
33
- newsworthycharts-1.65.3.dist-info/WHEEL,sha256=cVxcB9AmuTcXqmwrtPhNK88dr7IR_b6qagTj0UvIEbY,91
34
- newsworthycharts-1.65.3.dist-info/top_level.txt,sha256=dn_kzIj8UgUCMsh1PHdVEQJHVGSsN7Z8YJF-8xXa8n0,17
35
- newsworthycharts-1.65.3.dist-info/RECORD,,
31
+ newsworthycharts-1.66.0.dist-info/LICENSE.txt,sha256=Sq6kGICrehbhC_FolNdXf0djKjTpv3YqjFCIYsxdQN4,1069
32
+ newsworthycharts-1.66.0.dist-info/METADATA,sha256=SqN-YYHap7GyKv7Xy8y5yGQ4pHUtEFzDE_WO_4C__sI,30995
33
+ newsworthycharts-1.66.0.dist-info/WHEEL,sha256=cVxcB9AmuTcXqmwrtPhNK88dr7IR_b6qagTj0UvIEbY,91
34
+ newsworthycharts-1.66.0.dist-info/top_level.txt,sha256=dn_kzIj8UgUCMsh1PHdVEQJHVGSsN7Z8YJF-8xXa8n0,17
35
+ newsworthycharts-1.66.0.dist-info/RECORD,,