newsworthycharts 1.73.0__tar.gz → 1.73.1__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.73.0/newsworthycharts.egg-info → newsworthycharts-1.73.1}/PKG-INFO +9 -2
  2. {newsworthycharts-1.73.0 → newsworthycharts-1.73.1}/README.rst +7 -0
  3. {newsworthycharts-1.73.0 → newsworthycharts-1.73.1}/newsworthycharts/__init__.py +1 -1
  4. {newsworthycharts-1.73.0 → newsworthycharts-1.73.1}/newsworthycharts/chart.py +1 -1
  5. {newsworthycharts-1.73.0 → newsworthycharts-1.73.1}/newsworthycharts/choroplethmap.py +6 -1
  6. {newsworthycharts-1.73.0 → newsworthycharts-1.73.1}/newsworthycharts/lib/locator.py +17 -8
  7. {newsworthycharts-1.73.0 → newsworthycharts-1.73.1/newsworthycharts.egg-info}/PKG-INFO +9 -2
  8. {newsworthycharts-1.73.0 → newsworthycharts-1.73.1}/LICENSE.txt +0 -0
  9. {newsworthycharts-1.73.0 → newsworthycharts-1.73.1}/MANIFEST.in +0 -0
  10. {newsworthycharts-1.73.0 → newsworthycharts-1.73.1}/newsworthycharts/bubblemap.py +0 -0
  11. {newsworthycharts-1.73.0 → newsworthycharts-1.73.1}/newsworthycharts/categoricalchart.py +0 -0
  12. {newsworthycharts-1.73.0 → newsworthycharts-1.73.1}/newsworthycharts/custom/__init__.py +0 -0
  13. {newsworthycharts-1.73.0 → newsworthycharts-1.73.1}/newsworthycharts/custom/climate_cars.py +0 -0
  14. {newsworthycharts-1.73.0 → newsworthycharts-1.73.1}/newsworthycharts/datawrapper.py +0 -0
  15. {newsworthycharts-1.73.0 → newsworthycharts-1.73.1}/newsworthycharts/lib/__init__.py +0 -0
  16. {newsworthycharts-1.73.0 → newsworthycharts-1.73.1}/newsworthycharts/lib/color_fn.py +0 -0
  17. {newsworthycharts-1.73.0 → newsworthycharts-1.73.1}/newsworthycharts/lib/colors.py +0 -0
  18. {newsworthycharts-1.73.0 → newsworthycharts-1.73.1}/newsworthycharts/lib/datalist.py +0 -0
  19. {newsworthycharts-1.73.0 → newsworthycharts-1.73.1}/newsworthycharts/lib/formatter.py +0 -0
  20. {newsworthycharts-1.73.0 → newsworthycharts-1.73.1}/newsworthycharts/lib/geography.py +0 -0
  21. {newsworthycharts-1.73.0 → newsworthycharts-1.73.1}/newsworthycharts/lib/mimetypes.py +0 -0
  22. {newsworthycharts-1.73.0 → newsworthycharts-1.73.1}/newsworthycharts/lib/utils.py +0 -0
  23. {newsworthycharts-1.73.0 → newsworthycharts-1.73.1}/newsworthycharts/map.py +0 -0
  24. {newsworthycharts-1.73.0 → newsworthycharts-1.73.1}/newsworthycharts/maps/se-4.gpkg +0 -0
  25. {newsworthycharts-1.73.0 → newsworthycharts-1.73.1}/newsworthycharts/maps/se-7.gpkg +0 -0
  26. {newsworthycharts-1.73.0 → newsworthycharts-1.73.1}/newsworthycharts/rangeplot.py +0 -0
  27. {newsworthycharts-1.73.0 → newsworthycharts-1.73.1}/newsworthycharts/rankchart.py +0 -0
  28. {newsworthycharts-1.73.0 → newsworthycharts-1.73.1}/newsworthycharts/rc/newsworthy +0 -0
  29. {newsworthycharts-1.73.0 → newsworthycharts-1.73.1}/newsworthycharts/scatterplot.py +0 -0
  30. {newsworthycharts-1.73.0 → newsworthycharts-1.73.1}/newsworthycharts/seasonalchart.py +0 -0
  31. {newsworthycharts-1.73.0 → newsworthycharts-1.73.1}/newsworthycharts/serialchart.py +0 -0
  32. {newsworthycharts-1.73.0 → newsworthycharts-1.73.1}/newsworthycharts/storage.py +0 -0
  33. {newsworthycharts-1.73.0 → newsworthycharts-1.73.1}/newsworthycharts/stripechart.py +0 -0
  34. {newsworthycharts-1.73.0 → newsworthycharts-1.73.1}/newsworthycharts/translations/datawrapper_regions.csv +0 -0
  35. {newsworthycharts-1.73.0 → newsworthycharts-1.73.1}/newsworthycharts/translations/regions.py +0 -0
  36. {newsworthycharts-1.73.0 → newsworthycharts-1.73.1}/newsworthycharts/translations/se_municipalities.csv +0 -0
  37. {newsworthycharts-1.73.0 → newsworthycharts-1.73.1}/newsworthycharts.egg-info/SOURCES.txt +0 -0
  38. {newsworthycharts-1.73.0 → newsworthycharts-1.73.1}/newsworthycharts.egg-info/dependency_links.txt +0 -0
  39. {newsworthycharts-1.73.0 → newsworthycharts-1.73.1}/newsworthycharts.egg-info/not-zip-safe +0 -0
  40. {newsworthycharts-1.73.0 → newsworthycharts-1.73.1}/newsworthycharts.egg-info/requires.txt +0 -0
  41. {newsworthycharts-1.73.0 → newsworthycharts-1.73.1}/newsworthycharts.egg-info/top_level.txt +0 -0
  42. {newsworthycharts-1.73.0 → newsworthycharts-1.73.1}/setup.cfg +0 -0
  43. {newsworthycharts-1.73.0 → newsworthycharts-1.73.1}/setup.py +0 -0
  44. {newsworthycharts-1.73.0 → newsworthycharts-1.73.1}/test/test_categorical_chart.py +0 -0
  45. {newsworthycharts-1.73.0 → newsworthycharts-1.73.1}/test/test_choropleth_maps.py +0 -0
  46. {newsworthycharts-1.73.0 → newsworthycharts-1.73.1}/test/test_custom_climate_cars.py +0 -0
  47. {newsworthycharts-1.73.0 → newsworthycharts-1.73.1}/test/test_data_list.py +0 -0
  48. {newsworthycharts-1.73.0 → newsworthycharts-1.73.1}/test/test_datawrapper.py +0 -0
  49. {newsworthycharts-1.73.0 → newsworthycharts-1.73.1}/test/test_main.py +0 -0
  50. {newsworthycharts-1.73.0 → newsworthycharts-1.73.1}/test/test_rangeplot.py +0 -0
  51. {newsworthycharts-1.73.0 → newsworthycharts-1.73.1}/test/test_scatterplot.py +0 -0
  52. {newsworthycharts-1.73.0 → newsworthycharts-1.73.1}/test/test_serial_chart.py +0 -0
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: newsworthycharts
3
- Version: 1.73.0
3
+ Version: 1.73.1
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.73.0.tar.gz
6
+ Download-URL: https://github.com/jplusplus/newsworthycharts/archive/1.73.1.tar.gz
7
7
  Author: Jens Finnäs and Leo Wallentin, J++ Stockholm
8
8
  Author-email: stockholm@jplusplus.org
9
9
  License: MIT
@@ -160,6 +160,8 @@ These settings are available for all chart types:
160
160
  - baseline = 0 # The “zero” line. Useful for plotting deviations, e.g. temperatures above/below mean
161
161
  - baseline_annotation = None # A label for the baseline
162
162
  - line_width = None # To override style settings
163
+ - line_marker = "-"" # Matplotlib line marker type.
164
+ - line_marker_size = 3 # Matplotlib line marker size
163
165
  - max_ticks = 10 # Maximum number of ticks on the x axis. *Only used with yearly|decennial data* (this is yet to be fixed)
164
166
  - 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")]`
165
167
  - ymin = None # Minimum value on y axis. If None, it will be calculated from data
@@ -271,6 +273,11 @@ Roadmap
271
273
  Changelog
272
274
  ---------
273
275
 
276
+ - 1.73.1
277
+
278
+ - More leniant label parsing in ChoroplethMap
279
+ - Make max_ticks work in monthly time series charts.
280
+
274
281
  - 1.73.0
275
282
 
276
283
  - Add `type: "markers"` to serial charts. Uses a thin line with a marker at each data point as default.
@@ -134,6 +134,8 @@ These settings are available for all chart types:
134
134
  - baseline = 0 # The “zero” line. Useful for plotting deviations, e.g. temperatures above/below mean
135
135
  - baseline_annotation = None # A label for the baseline
136
136
  - line_width = None # To override style settings
137
+ - line_marker = "-"" # Matplotlib line marker type.
138
+ - line_marker_size = 3 # Matplotlib line marker size
137
139
  - max_ticks = 10 # Maximum number of ticks on the x axis. *Only used with yearly|decennial data* (this is yet to be fixed)
138
140
  - 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")]`
139
141
  - ymin = None # Minimum value on y axis. If None, it will be calculated from data
@@ -245,6 +247,11 @@ Roadmap
245
247
  Changelog
246
248
  ---------
247
249
 
250
+ - 1.73.1
251
+
252
+ - More leniant label parsing in ChoroplethMap
253
+ - Make max_ticks work in monthly time series charts.
254
+
248
255
  - 1.73.0
249
256
 
250
257
  - Add `type: "markers"` to serial charts. Uses a thin line with a marker at each data point as default.
@@ -1,4 +1,4 @@
1
- __version__ = "1.73.0"
1
+ __version__ = "1.73.1"
2
2
 
3
3
  from .chart import Chart
4
4
  from .choroplethmap import ChoroplethMap
@@ -427,7 +427,7 @@ class Chart(object):
427
427
  self.ax.xaxis.set_major_formatter(DateFormatter('%Y'))
428
428
 
429
429
  else:
430
- loc = get_best_locator(delta, len(dates), self.interval)
430
+ loc = get_best_locator(delta, len(dates), self.interval, max_ticks=self.max_ticks)
431
431
  self.ax.xaxis.set_major_locator(loc)
432
432
  formatter = Formatter(self._language)
433
433
 
@@ -174,6 +174,11 @@ class ChoroplethMap(Map):
174
174
  # We need to add it ourselves
175
175
  label_order = self.label_order or color_map.keys()
176
176
  for label in reversed(label_order):
177
+ if label not in color_map:
178
+ if str(label) in color_map:
179
+ label = str(label)
180
+ else:
181
+ continue
177
182
  color = color_map[label]
178
183
  # A bit of an hack:
179
184
  # Check if this corresponds to one of our predefined
@@ -229,4 +234,4 @@ class ChoroplethMap(Map):
229
234
  handles=patches,
230
235
  **label_kwargs,
231
236
  )
232
- #self.ax.get_figure().savefig("TST.png", bbox_inches="tight")
237
+ # self.ax.get_figure().savefig("TST.png", bbox_inches="tight")
@@ -1,7 +1,9 @@
1
1
  """ Custom locators and related methods
2
2
  """
3
- from matplotlib.dates import (YearLocator, MonthLocator, DayLocator,
4
- WeekdayLocator)
3
+ from matplotlib.dates import (YearLocator, DayLocator,
4
+ WeekdayLocator, AutoDateLocator)
5
+ import matplotlib.dates as mdates
6
+
5
7
  from datetime import datetime
6
8
  from dateutil.rrule import MO
7
9
 
@@ -36,7 +38,7 @@ def get_year_ticks(start_date, end_date, max_ticks=5):
36
38
  return selected_dates
37
39
 
38
40
 
39
- def get_best_locator(delta, points, interval=None):
41
+ def get_best_locator(delta, points, interval=None, max_ticks=None):
40
42
  """ Get the optimal locator given a time delta and number of points.
41
43
  This methods will be much more conservative than Matplotlib's AutoLocator,
42
44
  trying to keep the x axis as clean as possible, while still including
@@ -61,10 +63,12 @@ def get_best_locator(delta, points, interval=None):
61
63
  else:
62
64
  # Less than a year:
63
65
  if interval in ["monthly", "quarterly"]:
64
- if points > 12:
65
- return MonthLocator()
66
- else:
67
- return MonthLocator()
66
+ locator = AutoDateLocator(maxticks=max_ticks)
67
+ locator.intervald = {
68
+ mdates.MONTHLY: [1, 2, 3, 4, 6], # only allow monthly intervals
69
+ }
70
+ return locator
71
+ # return MonthLocator()
68
72
 
69
73
  elif interval == "weekly":
70
74
  # NB The threshold are not tested thoroughly. Consider adjusting.
@@ -82,7 +86,12 @@ def get_best_locator(delta, points, interval=None):
82
86
 
83
87
  elif interval == "daily" or interval is None:
84
88
  if delta.days > 30:
85
- return MonthLocator()
89
+ locator = AutoDateLocator(maxticks=max_ticks)
90
+ locator.intervald = {
91
+ mdates.MONTHLY: [1, 2, 3, 4, 6], # only allow monthly intervals
92
+ }
93
+ return locator
94
+ # return MonthLocator()
86
95
  elif delta.days > 21:
87
96
  return DayLocator(interval=10)
88
97
  elif delta.days > 7:
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: newsworthycharts
3
- Version: 1.73.0
3
+ Version: 1.73.1
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.73.0.tar.gz
6
+ Download-URL: https://github.com/jplusplus/newsworthycharts/archive/1.73.1.tar.gz
7
7
  Author: Jens Finnäs and Leo Wallentin, J++ Stockholm
8
8
  Author-email: stockholm@jplusplus.org
9
9
  License: MIT
@@ -160,6 +160,8 @@ These settings are available for all chart types:
160
160
  - baseline = 0 # The “zero” line. Useful for plotting deviations, e.g. temperatures above/below mean
161
161
  - baseline_annotation = None # A label for the baseline
162
162
  - line_width = None # To override style settings
163
+ - line_marker = "-"" # Matplotlib line marker type.
164
+ - line_marker_size = 3 # Matplotlib line marker size
163
165
  - max_ticks = 10 # Maximum number of ticks on the x axis. *Only used with yearly|decennial data* (this is yet to be fixed)
164
166
  - 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")]`
165
167
  - ymin = None # Minimum value on y axis. If None, it will be calculated from data
@@ -271,6 +273,11 @@ Roadmap
271
273
  Changelog
272
274
  ---------
273
275
 
276
+ - 1.73.1
277
+
278
+ - More leniant label parsing in ChoroplethMap
279
+ - Make max_ticks work in monthly time series charts.
280
+
274
281
  - 1.73.0
275
282
 
276
283
  - Add `type: "markers"` to serial charts. Uses a thin line with a marker at each data point as default.