newsworthycharts 1.71.3__tar.gz → 1.71.4__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.
Files changed (52) hide show
  1. {newsworthycharts-1.71.3/newsworthycharts.egg-info → newsworthycharts-1.71.4}/PKG-INFO +6 -2
  2. {newsworthycharts-1.71.3 → newsworthycharts-1.71.4}/README.rst +4 -0
  3. {newsworthycharts-1.71.3 → newsworthycharts-1.71.4}/newsworthycharts/__init__.py +1 -1
  4. {newsworthycharts-1.71.3 → newsworthycharts-1.71.4}/newsworthycharts/rankchart.py +60 -2
  5. {newsworthycharts-1.71.3 → newsworthycharts-1.71.4}/newsworthycharts/serialchart.py +5 -0
  6. {newsworthycharts-1.71.3 → newsworthycharts-1.71.4/newsworthycharts.egg-info}/PKG-INFO +6 -2
  7. {newsworthycharts-1.71.3 → newsworthycharts-1.71.4}/LICENSE.txt +0 -0
  8. {newsworthycharts-1.71.3 → newsworthycharts-1.71.4}/MANIFEST.in +0 -0
  9. {newsworthycharts-1.71.3 → newsworthycharts-1.71.4}/newsworthycharts/bubblemap.py +0 -0
  10. {newsworthycharts-1.71.3 → newsworthycharts-1.71.4}/newsworthycharts/categoricalchart.py +0 -0
  11. {newsworthycharts-1.71.3 → newsworthycharts-1.71.4}/newsworthycharts/chart.py +0 -0
  12. {newsworthycharts-1.71.3 → newsworthycharts-1.71.4}/newsworthycharts/choroplethmap.py +0 -0
  13. {newsworthycharts-1.71.3 → newsworthycharts-1.71.4}/newsworthycharts/custom/__init__.py +0 -0
  14. {newsworthycharts-1.71.3 → newsworthycharts-1.71.4}/newsworthycharts/custom/climate_cars.py +0 -0
  15. {newsworthycharts-1.71.3 → newsworthycharts-1.71.4}/newsworthycharts/datawrapper.py +0 -0
  16. {newsworthycharts-1.71.3 → newsworthycharts-1.71.4}/newsworthycharts/lib/__init__.py +0 -0
  17. {newsworthycharts-1.71.3 → newsworthycharts-1.71.4}/newsworthycharts/lib/color_fn.py +0 -0
  18. {newsworthycharts-1.71.3 → newsworthycharts-1.71.4}/newsworthycharts/lib/colors.py +0 -0
  19. {newsworthycharts-1.71.3 → newsworthycharts-1.71.4}/newsworthycharts/lib/datalist.py +0 -0
  20. {newsworthycharts-1.71.3 → newsworthycharts-1.71.4}/newsworthycharts/lib/formatter.py +0 -0
  21. {newsworthycharts-1.71.3 → newsworthycharts-1.71.4}/newsworthycharts/lib/geography.py +0 -0
  22. {newsworthycharts-1.71.3 → newsworthycharts-1.71.4}/newsworthycharts/lib/locator.py +0 -0
  23. {newsworthycharts-1.71.3 → newsworthycharts-1.71.4}/newsworthycharts/lib/mimetypes.py +0 -0
  24. {newsworthycharts-1.71.3 → newsworthycharts-1.71.4}/newsworthycharts/lib/utils.py +0 -0
  25. {newsworthycharts-1.71.3 → newsworthycharts-1.71.4}/newsworthycharts/map.py +0 -0
  26. {newsworthycharts-1.71.3 → newsworthycharts-1.71.4}/newsworthycharts/maps/se-4.gpkg +0 -0
  27. {newsworthycharts-1.71.3 → newsworthycharts-1.71.4}/newsworthycharts/maps/se-7.gpkg +0 -0
  28. {newsworthycharts-1.71.3 → newsworthycharts-1.71.4}/newsworthycharts/rangeplot.py +0 -0
  29. {newsworthycharts-1.71.3 → newsworthycharts-1.71.4}/newsworthycharts/rc/newsworthy +0 -0
  30. {newsworthycharts-1.71.3 → newsworthycharts-1.71.4}/newsworthycharts/scatterplot.py +0 -0
  31. {newsworthycharts-1.71.3 → newsworthycharts-1.71.4}/newsworthycharts/seasonalchart.py +0 -0
  32. {newsworthycharts-1.71.3 → newsworthycharts-1.71.4}/newsworthycharts/storage.py +0 -0
  33. {newsworthycharts-1.71.3 → newsworthycharts-1.71.4}/newsworthycharts/stripechart.py +0 -0
  34. {newsworthycharts-1.71.3 → newsworthycharts-1.71.4}/newsworthycharts/translations/datawrapper_regions.csv +0 -0
  35. {newsworthycharts-1.71.3 → newsworthycharts-1.71.4}/newsworthycharts/translations/regions.py +0 -0
  36. {newsworthycharts-1.71.3 → newsworthycharts-1.71.4}/newsworthycharts/translations/se_municipalities.csv +0 -0
  37. {newsworthycharts-1.71.3 → newsworthycharts-1.71.4}/newsworthycharts.egg-info/SOURCES.txt +0 -0
  38. {newsworthycharts-1.71.3 → newsworthycharts-1.71.4}/newsworthycharts.egg-info/dependency_links.txt +0 -0
  39. {newsworthycharts-1.71.3 → newsworthycharts-1.71.4}/newsworthycharts.egg-info/not-zip-safe +0 -0
  40. {newsworthycharts-1.71.3 → newsworthycharts-1.71.4}/newsworthycharts.egg-info/requires.txt +0 -0
  41. {newsworthycharts-1.71.3 → newsworthycharts-1.71.4}/newsworthycharts.egg-info/top_level.txt +0 -0
  42. {newsworthycharts-1.71.3 → newsworthycharts-1.71.4}/setup.cfg +0 -0
  43. {newsworthycharts-1.71.3 → newsworthycharts-1.71.4}/setup.py +0 -0
  44. {newsworthycharts-1.71.3 → newsworthycharts-1.71.4}/test/test_categorical_chart.py +0 -0
  45. {newsworthycharts-1.71.3 → newsworthycharts-1.71.4}/test/test_choropleth_maps.py +0 -0
  46. {newsworthycharts-1.71.3 → newsworthycharts-1.71.4}/test/test_custom_climate_cars.py +0 -0
  47. {newsworthycharts-1.71.3 → newsworthycharts-1.71.4}/test/test_data_list.py +0 -0
  48. {newsworthycharts-1.71.3 → newsworthycharts-1.71.4}/test/test_datawrapper.py +0 -0
  49. {newsworthycharts-1.71.3 → newsworthycharts-1.71.4}/test/test_main.py +0 -0
  50. {newsworthycharts-1.71.3 → newsworthycharts-1.71.4}/test/test_rangeplot.py +0 -0
  51. {newsworthycharts-1.71.3 → newsworthycharts-1.71.4}/test/test_scatterplot.py +0 -0
  52. {newsworthycharts-1.71.3 → newsworthycharts-1.71.4}/test/test_serial_chart.py +0 -0
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: newsworthycharts
3
- Version: 1.71.3
3
+ Version: 1.71.4
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.71.3.tar.gz
6
+ Download-URL: https://github.com/jplusplus/newsworthycharts/archive/1.71.4.tar.gz
7
7
  Author: Jens Finnäs and Leo Wallentin, J++ Stockholm
8
8
  Author-email: stockholm@jplusplus.org
9
9
  License: MIT
@@ -270,6 +270,10 @@ Roadmap
270
270
  Changelog
271
271
  ---------
272
272
 
273
+ - 1.71.4
274
+
275
+ - BumpChart: Use dual colors in line markers when rank is shared
276
+
273
277
  - 1.71.3
274
278
 
275
279
  - Revert 1.71.2 changes to rendering, to make file sizes predictable again
@@ -244,6 +244,10 @@ Roadmap
244
244
  Changelog
245
245
  ---------
246
246
 
247
+ - 1.71.4
248
+
249
+ - BumpChart: Use dual colors in line markers when rank is shared
250
+
247
251
  - 1.71.3
248
252
 
249
253
  - Revert 1.71.2 changes to rendering, to make file sizes predictable again
@@ -1,4 +1,4 @@
1
- __version__ = "1.71.3"
1
+ __version__ = "1.71.4"
2
2
 
3
3
  from .chart import Chart
4
4
  from .choroplethmap import ChoroplethMap
@@ -19,6 +19,8 @@ class BumpChart(SerialChart):
19
19
 
20
20
  if self.line_width is None:
21
21
  self.line_width = 0.9
22
+ if self.line_marker_size is None:
23
+ self.line_marker_size = 6
22
24
  self.label_placement = 'none'
23
25
  self.type = "line"
24
26
  self.decimals = 0
@@ -29,7 +31,6 @@ class BumpChart(SerialChart):
29
31
  self.accentuate_baseline = False
30
32
 
31
33
  self.line_marker = "o-"
32
- self.line_marker_size = 5
33
34
 
34
35
  def _get_line_colors(self, i, *args):
35
36
  if not self.data:
@@ -41,15 +42,69 @@ class BumpChart(SerialChart):
41
42
  return self.colors[i]
42
43
  return self._nwc_style["neutral_color"]
43
44
 
45
+ """
46
+ def _get_marker_fill(self, i):
47
+ pass
48
+ """
49
+
44
50
  def _after_add_data(self):
45
51
  # Print out every rank
46
52
  if self.data.max_val < 30:
47
53
  _range = list(range(1, int(self.data.max_val) + 1))
48
54
  self.ax.yaxis.set_ticks(_range, _range)
55
+
56
+ # Recolor markers with more than one line passing through
57
+ # (MPL does not allow access to individual markers, so we'll overwrite them)
58
+
59
+ for date in self.data.x_points:
60
+ value_colors = {}
61
+ for i, serie in enumerate(self.data):
62
+ values = np.array(self.serie_values[i], dtype=np.float64)
63
+ dates = [x[0] for x in serie]
64
+ color = self._get_line_colors(i)
65
+ if date not in dates:
66
+ continue
67
+ idx = dates.index(date)
68
+ if np.isnan(values[idx]):
69
+ continue
70
+ val = int(values[idx])
71
+ if val not in value_colors:
72
+ value_colors[val] = []
73
+ value_colors[val].append(color)
74
+ for val, colors in value_colors.items():
75
+ if len(colors) < 2:
76
+ continue
77
+ elif len(colors) == 2:
78
+ self.ax.plot(
79
+ to_date(date),
80
+ val,
81
+ self.line_marker,
82
+ markersize=self.line_marker_size,
83
+ color="None",
84
+ fillstyle="left",
85
+ markeredgewidth=0,
86
+ markerfacecolor=colors[0],
87
+ markerfacecoloralt=colors[1],
88
+ zorder=100,
89
+ )
90
+ else:
91
+ self.ax.plot(
92
+ to_date(date),
93
+ val,
94
+ self.line_marker,
95
+ markersize=self.line_marker_size,
96
+ color=self._nwc_style["neutral_color"],
97
+ markeredgewidth=0,
98
+ zorder=100,
99
+ )
49
100
  # Add labels
50
101
  slots_occupied = {
51
102
  to_date(k): [] for k in self.data.x_points
52
103
  }
104
+ # distance between rank ticks
105
+ # y1 = self.ax.transData.transform((0, 1))
106
+ # y2 = self.ax.transData.transform((0, 2))
107
+ # dist = abs(y1[1] - y2[1])
53
108
  for i, serie in enumerate(self.data):
54
109
  values = np.array(self.serie_values[i], dtype=np.float64)
55
110
  dates = [to_date(x[0]) for x in serie]
@@ -63,15 +118,18 @@ class BumpChart(SerialChart):
63
118
  position = ep[1]
64
119
  while position in slots_occupied[ep[0]]:
65
120
  position += 1
121
+ # pos_diff = position - ep[1]
66
122
  slots_occupied[ep[0]].append(position)
67
123
  self._annotate_point(
68
124
  self.labels[i],
125
+ # (ep[0], ep[1]),
69
126
  (ep[0], position),
70
127
  "right",
71
128
  offset=15,
72
129
  color=color,
73
130
  va="center",
74
- # arrowprops=dict(arrowstyle="->", color=color),
131
+ # xytext=(15, -abs(y1[1] - y2[1]) * pos_diff),
132
+ # arrowprops=dict(arrowstyle="->", color=color) if pos_diff > 1 else None,
75
133
  )
76
134
  """
77
135
  labels = []
@@ -254,6 +254,9 @@ class SerialChart(Chart):
254
254
  color = self._nwc_style["strong_color"]
255
255
  else:
256
256
  color = self._nwc_style["neutral_color"]
257
+ marker_fill = None
258
+ if hasattr(self, "_get_marker_fill"):
259
+ marker_fill = self._get_marker_fill(i)
257
260
 
258
261
  line, = self.ax.plot(
259
262
  dates,
@@ -261,6 +264,8 @@ class SerialChart(Chart):
261
264
  self.line_marker,
262
265
  markersize=self.line_marker_size,
263
266
  color=color,
267
+ markerfacecolor=marker_fill,
268
+ markeredgewidth=0,
264
269
  zorder=zo,
265
270
  lw=lw,
266
271
  )
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: newsworthycharts
3
- Version: 1.71.3
3
+ Version: 1.71.4
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.71.3.tar.gz
6
+ Download-URL: https://github.com/jplusplus/newsworthycharts/archive/1.71.4.tar.gz
7
7
  Author: Jens Finnäs and Leo Wallentin, J++ Stockholm
8
8
  Author-email: stockholm@jplusplus.org
9
9
  License: MIT
@@ -270,6 +270,10 @@ Roadmap
270
270
  Changelog
271
271
  ---------
272
272
 
273
+ - 1.71.4
274
+
275
+ - BumpChart: Use dual colors in line markers when rank is shared
276
+
273
277
  - 1.71.3
274
278
 
275
279
  - Revert 1.71.2 changes to rendering, to make file sizes predictable again