newsworthycharts 1.57.1__py3-none-any.whl → 1.57.3__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.57.1"
1
+ __version__ = "1.57.3"
2
2
 
3
3
  from .chart import Chart
4
4
  from .choroplethmap import ChoroplethMap
@@ -16,7 +16,7 @@ class CategoricalChart(Chart):
16
16
  self.stacked = False
17
17
  self.legend = True
18
18
 
19
- # Optional: specify a list of colors (for mulitple datasets)
19
+ # Optional: specify a list of colors (for multiple datasets)
20
20
  self.colors = None
21
21
 
22
22
  def _add_data(self):
@@ -144,8 +144,8 @@ class CategoricalChart(Chart):
144
144
  kwargs["bottom"] = cum_values[i - 1]
145
145
  self.ax.bar(bar_pos, values, **kwargs)
146
146
 
147
- margin = 0.02 # above and below first/last bar on horizontal
148
147
  if self.bar_orientation == "horizontal":
148
+ margin = 0.02 # above and below first/last bar on horizontal
149
149
  self.ax.set_yticks(bar_pos)
150
150
  self.ax.set_yticklabels(categories)
151
151
  self.ax.invert_yaxis()
@@ -158,6 +158,7 @@ class CategoricalChart(Chart):
158
158
  self._fig.subplots_adjust(left=margin)
159
159
 
160
160
  elif self.bar_orientation == "vertical":
161
+ margin = 0.01 # above and below first/last bar on horizontal
161
162
  self.ax.margins(margin, 0)
162
163
  self.ax.set_xticks(bar_pos)
163
164
  self.ax.set_xticklabels(categories)
newsworthycharts/chart.py CHANGED
@@ -168,7 +168,7 @@ class Chart(object):
168
168
  ismath=False,
169
169
  )
170
170
  num_lines = len(obj._get_wrapped_text().split("\n"))
171
- return (h * num_lines) / float(self._h)
171
+ return (h * (num_lines * 1.4)) / float(self._h) # 1.4 is the line spacing used everywhere
172
172
 
173
173
  def _rel_height(self, obj):
174
174
  """ Get the relative height of a chart object to the whole canvas.
@@ -273,7 +273,7 @@ class Chart(object):
273
273
  def _add_title(self, title_text):
274
274
  """Add a title."""
275
275
  # y=1 wraps title heavily, hence .9999
276
- text = self._fig.suptitle(title_text, wrap=True, x=0, y=0.985,
276
+ text = self._fig.suptitle(title_text, wrap=True, x=0, y=0.999,
277
277
  horizontalalignment="left",
278
278
  multialignment="left",
279
279
  fontproperties=self._title_font)
@@ -755,7 +755,7 @@ class Chart(object):
755
755
  rel_height = 0
756
756
  if self._title_elem:
757
757
  rel_height += self._text_rel_height(self._title_elem)
758
- # Adds a fixes margin below
758
+ # Adds a fixed margin below
759
759
  rel_height += 30 / self._h
760
760
  return rel_height
761
761
 
@@ -764,8 +764,8 @@ class Chart(object):
764
764
  rel_height = 0
765
765
  if self._subtitle_elem:
766
766
  rel_height += self._text_rel_height(self._subtitle_elem)
767
- # Adds a fixes margin below
768
- rel_height += 30 / self._h
767
+ # Adds a fixed margin below
768
+ rel_height += 15 / self._h
769
769
  return rel_height
770
770
 
771
771
  @property
@@ -773,7 +773,7 @@ class Chart(object):
773
773
  rel_height = 0
774
774
  if self._note_elem:
775
775
  rel_height += self._text_rel_height(self._note_elem)
776
- # Adds a fixes margin below
776
+ # Adds a fixed margin below
777
777
  rel_height += 10 / self._h
778
778
  return rel_height
779
779
 
@@ -2,7 +2,6 @@
2
2
  Simple choropleths for common administrative areas
3
3
  """
4
4
  from .map import Map
5
- from shapely.geometry.multipolygon import MultiPolygon
6
5
  import geopandas as gpd
7
6
  import numpy as np
8
7
  import pandas as pd
newsworthycharts/map.py CHANGED
@@ -99,7 +99,12 @@ class Map(Chart):
99
99
  def _normalize_region_code(self, code):
100
100
  code = code.upper().replace("_", "-")
101
101
  # Apply translation, if we find and applicable one
102
- region_translation = REGION_TRANSLATIONS.get(self.base_map, {})
102
+
103
+ # normalize basemap name, so that `se|03-7` is treated as `se-7
104
+ # region_translation = REGION_TRANSLATIONS.get(self.base_map, {})
105
+ _base_map, _subdivisions, _subset, *opts = self.parse_basemap()
106
+ region_translation = REGION_TRANSLATIONS.get(f"{_base_map}-{_subdivisions}", {})
107
+
103
108
  region_translation = {k.upper(): v for k, v in region_translation.items()}
104
109
  code = region_translation.get(code, code)
105
110
  return code
@@ -132,7 +137,7 @@ class Map(Chart):
132
137
  if len(_) > 1:
133
138
  [base_map, subset] = _
134
139
 
135
- if not self.df:
140
+ if self.df is None:
136
141
  __dir = pathlib.Path(__file__).parent.resolve()
137
142
  try:
138
143
  self.df = gpd.read_file(f"{__dir}/maps/{base_map}-{subdivisions}.gpkg")
@@ -0,0 +1,26 @@
1
+ Metadata-Version: 2.1
2
+ Name: newsworthycharts
3
+ Version: 1.57.3
4
+ Summary: Matplotlib wrapper to create charts and publish them on Amazon S3
5
+ Home-page: https://github.com/jplusplus/newsworthycharts
6
+ Download-URL: https://github.com/jplusplus/newsworthycharts/archive/1.57.3.tar.gz
7
+ Author: Jens Finnäs and Leo Wallentin, J++ Stockholm
8
+ Author-email: stockholm@jplusplus.org
9
+ License: MIT
10
+ Requires-Python: >=3.9
11
+ License-File: LICENSE.txt
12
+ Requires-Dist: Babel <3,>=2.14.0
13
+ Requires-Dist: Pillow ==10.3.0
14
+ Requires-Dist: PyYAML >=3
15
+ Requires-Dist: adjustText ==0.7.3
16
+ Requires-Dist: boto3 >=1.26
17
+ Requires-Dist: geopandas ==0.14.3
18
+ Requires-Dist: langcodes >=3.3
19
+ Requires-Dist: mapclassify ==2.6.1
20
+ Requires-Dist: matplotlib-label-lines ==0.5.1
21
+ Requires-Dist: matplotlib ==3.8.4
22
+ Requires-Dist: numpy <2,>=1.21.0
23
+ Requires-Dist: python-dateutil <3,>=2
24
+ Requires-Dist: requests >=2.22
25
+
26
+ Matplotlib wrapper to create charts and publish them on Amazon S3
@@ -1,10 +1,10 @@
1
- newsworthycharts/__init__.py,sha256=KwgSbe7UCJDXJhb66gLqhiZ1or8woAGXKYTXvM3YQo8,1160
1
+ newsworthycharts/__init__.py,sha256=PpwFsYOJecyNvthtoUo5_8GuiKOUzpCvdL30xQmHLqQ,1160
2
2
  newsworthycharts/bubblemap.py,sha256=nkocWmpiFgfjEuJGAsthjY5X7Q56jXWsZHUGXw4PwgE,2587
3
- newsworthycharts/categoricalchart.py,sha256=k2cd96pNysbVU88nZduiLGpzyjMsDXTbASAVu6ov-kI,14686
4
- newsworthycharts/chart.py,sha256=YXoK2VvB7t8sfVrCVkLpPulHHsDKQZKAm_aTCig_4ck,30583
5
- newsworthycharts/choroplethmap.py,sha256=YamK4yf7X5y7VU_13I3iKE4KbwJ1Ie2x9fezwCh17cg,6124
3
+ newsworthycharts/categoricalchart.py,sha256=LwOZ3VbNy9vzvoK0s77AkbfMt4CXVDSAhnsnBInUIrE,14764
4
+ newsworthycharts/chart.py,sha256=zVBkbCX4c3JjPhweXPXELkxbYMJDX1jSDVsoTfS1A7k,30634
5
+ newsworthycharts/choroplethmap.py,sha256=2b61MuYed8ccc7uZkzuSdZDbqVR7C3OP1ftb_khuaLw,6069
6
6
  newsworthycharts/datawrapper.py,sha256=RRkAVTpfP4updKxUIBaSmKuBi2RUVPaBRF8HDQhlGGA,11250
7
- newsworthycharts/map.py,sha256=e0WRcLTmb1KPZ7_-05QXgthMEmKrTpnci40DXnmd6Rc,5984
7
+ newsworthycharts/map.py,sha256=ruhFEFmGg8DwySDPnEbx_4n57DgHL5LlLKQEnoNmuIU,6225
8
8
  newsworthycharts/rangeplot.py,sha256=NE1W9TnmlpK6T3RvBJOU3nd73EXqkj17OY9i5zlw_cQ,8366
9
9
  newsworthycharts/scatterplot.py,sha256=6iaMoiZx__Gc-2Hcdw-8Ga5dSonrFo3oexKNmSFuir4,4959
10
10
  newsworthycharts/seasonalchart.py,sha256=rr55yqJUkaYDR9Ik98jes6574oY1U8t8LwoLE3gClW4,1967
@@ -28,8 +28,8 @@ newsworthycharts/rc/newsworthy,sha256=X0btLNrmk2DRrfOsKj_WCSIgeD6btacEN2tRF_B4m8
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.57.1.dist-info/LICENSE.txt,sha256=Sq6kGICrehbhC_FolNdXf0djKjTpv3YqjFCIYsxdQN4,1069
32
- newsworthycharts-1.57.1.dist-info/METADATA,sha256=RnpK8VFn5k0_gYUJOEUlLkIAaKb_8Cwm57K9akt8YIg,26362
33
- newsworthycharts-1.57.1.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
34
- newsworthycharts-1.57.1.dist-info/top_level.txt,sha256=dn_kzIj8UgUCMsh1PHdVEQJHVGSsN7Z8YJF-8xXa8n0,17
35
- newsworthycharts-1.57.1.dist-info/RECORD,,
31
+ newsworthycharts-1.57.3.dist-info/LICENSE.txt,sha256=Sq6kGICrehbhC_FolNdXf0djKjTpv3YqjFCIYsxdQN4,1069
32
+ newsworthycharts-1.57.3.dist-info/METADATA,sha256=QyG_NW74zoiyh0PNXGRD_WrYS3GkvCeVoJEAbST2cUQ,930
33
+ newsworthycharts-1.57.3.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
34
+ newsworthycharts-1.57.3.dist-info/top_level.txt,sha256=dn_kzIj8UgUCMsh1PHdVEQJHVGSsN7Z8YJF-8xXa8n0,17
35
+ newsworthycharts-1.57.3.dist-info/RECORD,,
@@ -1,975 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: newsworthycharts
3
- Version: 1.57.1
4
- Summary: Matplotlib wrapper to create charts and publish them on Amazon S3
5
- Home-page: https://github.com/jplusplus/newsworthycharts
6
- Download-URL: https://github.com/jplusplus/newsworthycharts/archive/1.57.1.tar.gz
7
- Author: Jens Finnäs and Leo Wallentin, J++ Stockholm
8
- Author-email: stockholm@jplusplus.org
9
- License: MIT
10
- Requires-Python: >=3.9
11
- Description-Content-Type: text/x-rst
12
- License-File: LICENSE.txt
13
- Requires-Dist: Babel <3,>=2.14.0
14
- Requires-Dist: Pillow ==10.3.0
15
- Requires-Dist: PyYAML >=3
16
- Requires-Dist: adjustText ==0.7.3
17
- Requires-Dist: boto3 >=1.26
18
- Requires-Dist: geopandas ==0.14.3
19
- Requires-Dist: langcodes >=3.3
20
- Requires-Dist: mapclassify ==2.6.1
21
- Requires-Dist: matplotlib-label-lines ==0.5.1
22
- Requires-Dist: matplotlib ==3.8.4
23
- Requires-Dist: numpy <2,>=1.21.0
24
- Requires-Dist: python-dateutil <3,>=2
25
- Requires-Dist: requests >=2.22
26
-
27
- This module contains methods for producing graphs and publishing them on Amazon S3, or in the location of your choice.
28
-
29
- It is written and maintained for `Newsworthy <https://www.newsworthy.se/en/>`_, but could possibly come in handy for other people as well.
30
-
31
- By `Journalism++ Stockholm <http://jplusplus.org/sv>`_.
32
-
33
- Installing
34
- ----------
35
-
36
- .. code-block:: bash
37
-
38
- pip install newsworthycharts
39
-
40
-
41
- Using
42
- -----
43
-
44
- This module comes with two classes, `Chart` and `Storage` (and it's subclasses).
45
- When using the Chart class, the generated chart will be saved as a local file:
46
-
47
- .. code-block:: python3
48
-
49
- from newsworthycharts import SerialChart as Chart
50
-
51
-
52
- c = Chart(600, 800)
53
- c.title = "Number of smiles per second"
54
- c.xlabel = "Time"
55
- c.ylabel = "Smiles"
56
- c.caption = "Source: Ministry of smiles."
57
- data_serie_1 = [("2008-01-01", 6.1), ("2009-01-01", 5.9), ("2010-01-01", 6.8)]
58
- c.data.append(data_serie_1)
59
- c.highlight = "2010-01-01"
60
- c.render("test", "png")
61
-
62
- You can use one of the predefine chart classes to make common chart types. Or you can use Newsworthycharts together with Matplotlib. This is useful is you just want to add text elements such as subtitle, notes or apply a predefine theme.
63
-
64
- Here is how you would make a pie chart:
65
-
66
- .. code-block:: python3
67
-
68
- # data
69
- labels = 'Frogs', 'Hogs', 'Dogs', 'Logs'
70
- sizes = [15, 30, 45, 10]
71
-
72
- # setup chart
73
- chart = Chart(width=800, height=600, storage=local_storage)
74
- chart.title = "My pie chart"
75
- chart.subtitle = "Look at all those colors"
76
-
77
- # NB: Render the chart to `chart.ax`
78
- chart.ax.pie(sizes, labels=labels, autopct='%1.1f%%')
79
-
80
- # Save the chart
81
- chart.render("tailored_chart", "png")
82
-
83
- You can use a _storage_ object to save file to
84
- a specific location or cloud service:
85
-
86
- .. code-block:: python3
87
-
88
- from newsworthycharts import Chart
89
- from newsworthycharts import S3Storage
90
-
91
- s3 = S3Storage("my_bucket")
92
- c = Chart(600, 800, storage=s3)
93
- c.title = "Number of smiles per second"
94
- c.subtitle = "This chart tells you something very important."
95
- c.xlabel = "Time"
96
- c.ylabel = "Smiles"
97
- c.note = "There are some missing smiles in data"
98
- c.caption = "Source: Ministry of smiles."
99
- c.render("test", "png")
100
-
101
-
102
- To store a file in a local folder, use the `LocalStorage` class:
103
-
104
- .. code-block:: python3
105
-
106
- from newsworthycharts import LocalStorage
107
-
108
- storage = LocalStorage("/path/to/generated/charts")
109
-
110
- Charts are styled using built-in or user-defined styles:
111
-
112
- .. code-block:: python3
113
-
114
- from newsworthycharts import Chart
115
-
116
- # This chart has the newsworthy default style
117
- c = Chart(600, 800, style="newsworthy")
118
-
119
- # Style can also be the path to a style file (absolute or relative to current working directory)
120
- c2 = Chart(600, 800, style="path/to/styles/mystyle.mplstyle")
121
-
122
- To set up you own style, copy the build-in default: <https://github.com/jplusplus/newsworthycharts/blob/master/newsworthycharts/rc/newsworthy>
123
-
124
- Newsworthycharts will look first among the predefined style files for the requested style, so if you have a custom style file in you working directory you need to give it a unique name not already in use.
125
-
126
- Options
127
- -------
128
-
129
- **Chart**
130
-
131
- These settings are available for all chart types:
132
-
133
- - data: A list of datasets
134
- - annotate_trend = True # Print out values at points on trendline?
135
- - trendline = [] # List of x positions, or data points
136
- - yline = None # A horizontal line across the chart (Matplotlib: axhline)
137
- - labels = [] # Optionally one label for each dataset
138
- - annotations = [] # Manually added annotations
139
- - interval = None # yearly|quarterly|monthly|weekly|daily
140
- - units = 'number' # number|percent|degrees
141
- - show_ticks = True # toggle category names, dates, etc
142
- - subtitle = None
143
- - note = None
144
- - xlabel = None
145
- - ylabel = None
146
- - caption = None
147
- - highlight = A position (typically a date, category label or index) to highlight. The semantics may differ somewhat between chart types.
148
- - decimals = None # None means automatically chose the best number
149
- - logo = None # Path to image that will be embedded in the caption area. Can also be set though a style property
150
- - color_fn = None # Custom coloring function
151
-
152
- **SerialChart**
153
-
154
- - type = 'line' # line|bar|stacked_bar
155
- - bar_width = 0.9 # percent of data point width
156
- - allow_broken_y_axis = True|False # default depends on chart type
157
- - baseline = 0 # The “zero” line. Useful for plotting deviations, e.g. temperatures above/below mean
158
- - baseline_annotation = None # A label for the baseline
159
- - line_width = None # To override style settings
160
- - max_ticks = 7 # Maximum number of ticks on the x axis
161
- - 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")]`
162
- - ymin = None # Minimum value on y axis. If None, it will be calculated from data
163
- - ymax = None # Maximum value on y axis. If None, it will be calculated from data
164
- - colors = None # A list of colors, each correspoding to one dataseries. Default behaviour is to use the style colors
165
- - value_labels = False # Print out values at points on line?
166
- - highlighted_x_ranges = [] # List of tuples with start and end of highlighted areas
167
- - label_placement = "legend" # legend|inline|outside
168
- - color_labels = None # A dictionary of label/color, to override style colors
169
-
170
- **SeasonalChart**
171
-
172
- **BubbleMap**
173
-
174
- - bubble_size = 1 # The size of the bubbles
175
-
176
- **CategoricalChart**
177
-
178
- - bar_orientation = "horizontal" # [horizontal|vertical]
179
- - annotation_rotation = 0
180
- - stacked = False
181
- - legend = True
182
- - colors = None
183
-
184
- **CategoricalChartWithReference**
185
-
186
- **Map**
187
-
188
- - bins = 9 # Number of bins for continuous data
189
- - binning_method = "natural_breaks"
190
- - colors = None
191
- - color_ramp = "YlOrRd"
192
- - categorical = False # If True, the map will be colored by category. If False, it will be colored by a continuous value
193
- - base_map = None
194
- - missing_label = None # Add a label for no data
195
-
196
- **ChoroplethMap**
197
-
198
- **ProgressChart**
199
-
200
- **RangePlot**
201
-
202
- **ScatterPlot**
203
-
204
- **StripeChart**
205
-
206
- Developing
207
- ----------
208
-
209
- To run tests:
210
-
211
- .. code-block:: python3
212
-
213
- python3 -m flake8
214
- python3 -m pytest
215
-
216
- Deployment
217
- ----------
218
-
219
- To deploy a new version to [PyPi](https://pypi.org/project/newsworthycharts):
220
-
221
- 1. Update Changelog below.
222
- 2. Update the version number in newsworthycharts/__init__.py
223
- 3. Create and push a git tag: `git tag VERSION; git push --tags` (not strictly needed, but nice)
224
- 4. Build: `python3 setup.py sdist bdist_wheel`
225
- 5. Check: `python3 -m twine check dist/newsworthycharts-X.Y.X*`
226
- 6. Upload: `python3 -m twine upload dist/newsworthycharts-X.Y.X*`
227
-
228
- ...assuming you have Twine installed (`pip3 install twine`) and configured.
229
-
230
- Roadmap
231
- -------
232
- - Adding more base maps
233
- - Getting rid of custom settings-hack
234
- - Custom month locator with equal-width month bars
235
-
236
-
237
- Changelog
238
- ---------
239
-
240
- - 1.57.1
241
-
242
- - Fix missing outline in choropleth maps
243
- - matplotlib==3.8.4; Pillow==10.3.0
244
-
245
- - 1.57.0
246
-
247
- - Changed z-ordering so that line are always on top of bars, and ylines/zero lines are behind lines but in front of bars
248
- - Avoid using the same color for trendline and lines
249
- - `yline` was moved to the SerialChart class, where it makes sense.
250
-
251
- - 1.56.0
252
-
253
- - Reverted trendline behaviour to 1.54
254
- - Added `yline` to add a horizontal line across the chart (Matplotlib: axhline).
255
-
256
- - 1.55.0
257
-
258
- - Always use neutral color for trendline
259
-
260
- - 1.54.6
261
-
262
- - Improved logic for trendline coloring
263
- - Somewhat thinner trendline
264
-
265
- - 1.54.5
266
-
267
- - Improved tick placement in daily charts
268
- - Minor upgrades: matplotlib==3.8.3; Pillow==10.2.0; geopandas==0.14.3
269
-
270
- - 1.54.4
271
-
272
- - Use Babel 2.14, and pin version
273
- - Require numpy>=1.21.0 (now required by Matplotlib)
274
- - Patch upgrades: matplotlib==3.8.2; geopandas==0.14.1
275
-
276
- - 1.54.3
277
-
278
- - Fix duplicated integer values in y axis
279
-
280
- - 1.54.2
281
-
282
- - Make sure that legend is always on top of bars in stacked bar charts
283
- - Support more stacked categories in serial bar charts
284
-
285
- - 1.52.2+
286
-
287
- - Backport various 1.54.x fixes
288
-
289
- - 1.54.1
290
-
291
- - Patch upgrade Matplotlib to 3.8.1
292
-
293
- - 1.54.0
294
-
295
- - Treat 'jpeg' format as 'jpg'
296
- - Fixed a rendering bug in stacked bar charts with multiple values being 0
297
- - Pillow upgraded to 10.1
298
-
299
- - 1.53.0
300
-
301
- - Fixed bug in value_labels, trying to access a color value that didn't exist
302
- - Dropped Python 3.8 support (upstream)
303
- - Uses Matplotlib 3.8
304
- - Uses Pillow 10
305
-
306
- - 1.52.1
307
-
308
- - Fixed date formatting issue in daily charts
309
-
310
- - 1.52.0
311
-
312
- - No longer render EPS files by default.
313
-
314
- - 1.51.2
315
-
316
- - _Really_ fix dependencies
317
-
318
- - 1.51.1
319
-
320
- - Fix error in dependency verison
321
-
322
- - 1.51.0
323
-
324
- - Added `BubbleMap`
325
- - Added `se-4` basemap for Swedish counties
326
- - Basemaps can now have multiplygons
327
- - Downgraded adjustText to 0.7.3, as upgrade broke rendering constistency in some places
328
-
329
- - 1.50.2
330
-
331
- - Revert `matplotlib-label-lines` to previous version.
332
-
333
- - 1.50.0
334
-
335
- - Dropped Python 3.7 support (upstream)
336
- - Pinned Pillow to exact version in setup.py, for consistent rendering
337
- - `StripeChart`: First draft
338
-
339
- - 1.49.1
340
-
341
- - `ProgressChart`: Better value label placement.
342
-
343
- - 1.49.0
344
-
345
- - `ProgressChart`: Enable custom value labels as third argument in data serie.
346
-
347
- - 1.48.2
348
-
349
- - Bug fix: Handle translation in inset maps in `ChoroplethMap`.
350
-
351
- - 1.48.1
352
-
353
- - Bug fix: Path to translation file in `ChoroplethMap`.
354
-
355
- - 1.48.0
356
-
357
- - `ChoroplethMap`: Allow Newsworthy region names.
358
- - `RangePlot`: Re-add `start_label` that had been (mistakenly?) commented out.
359
-
360
- - 1.47.2
361
-
362
- - Bug fix: Fixes legend issue in `ProgressChart`.
363
-
364
- - 1.47.1
365
-
366
- - Data point annotation now works for serial charts as well
367
- - Bug fix: Re-enable `qualitative_colors` as `color` argument in SerialChart (line).
368
-
369
- - 1.47.0
370
-
371
- - Support for rendering jpeg files, as `jpg`
372
- - Minimum required Python version is now 3.7 (jumping from 3.5)
373
- - Matplotlib@3.7.1
374
-
375
- - 1.46.3
376
-
377
- - Fix z-ordering issue on multiple series (n > 2)
378
-
379
- - 1.46.2
380
-
381
- - Fix tag mismatch in dist
382
-
383
- - 1.46.1
384
-
385
- - Add missing haversine transform for non-projected crs
386
-
387
- - 1.46.0
388
-
389
- - `height` can be set to None for automatic ratio, for chart types that support it. Will default to 1:1 for most chart types, but maps will try to provide a reasonable default based on geometry. Some chart types still require explicit height
390
- - It is now possible to use subsets of basemaps, by specifying a prefix: `se|03-7` means regions starting with `03` in `se-7`
391
- - Added .missing_label to ChoroplethMap. If None (default), no label will be printed.
392
- - Always accentuate base_line (/y=0), and make sure that line is on top of any bars to avoid “floating” bars
393
- - Improved error handling in ChoroplethMap
394
- - Clean up figure layout logic (this should speed up rendering somewhat)
395
-
396
- - 1.45.0
397
-
398
- - Increased default `max_ticks` in SerialChart to 7
399
- - Matplotlib==3.7.0
400
- - adjustText==0.8.0
401
- - ChoroplethMap legend formatting, following language, decimals and units settings, etc
402
- - Minor tweaks to the layout algorithm. Might affect padding in some charts.
403
- - ChoroplethMap now does some basic normalizing of region codes
404
- - Added some data sanity checks, and improved error messages in ChoroplethMap
405
- - Added tests for ChoroplethMap
406
-
407
- - 1.44.4
408
-
409
- - Do not default to broken y axis if chart contains a bar series.
410
-
411
- - 1.44.3
412
-
413
- - Fix bug and occasional crash when using baseline with None values
414
-
415
- - 1.44.2
416
-
417
- - Fix crash in serialchart coloring chain
418
-
419
- - 1.44.1
420
-
421
- - Fix regression in SeasonalChart bar coloring
422
-
423
- - 1.44.0
424
-
425
- - Added grey outline to choropleth maps
426
- - The `type` argument is now a list with one type per data serie. Using a string is still supported for backwards compability. This makes it possible to make mixed type charts.
427
- - Reworked, simpler and more stable bar coloring algorithm
428
- - The `type` argument is no longer a getter/setter
429
- - Reduced edge for bar chartswith many bars
430
- - Removed unused, undocumented special colors value `"qualitative_colors"`. We have reasonable defaults for all chart types, that can already be overridden. The qualitative colors are used by default for qualitative data.
431
- - Removed unused, undocumented support for highlighting a series by label, rather than a value. The first series is highlighted by default, and that behaviour can already be overriden by the `.colors` setting
432
-
433
- - 1.43.4
434
-
435
- - Add more space for label title on se-7 maps
436
-
437
- - 1.43.3
438
-
439
- - Don't try to render map insets with no data
440
- - Use style colors in categorical choropleth maps
441
- - Added missing support for coloring categorical maps with `.colors`
442
- - Make automatic labeling work on categorical maps with `.colors`
443
- - Somewhat lighter fill for missing values in choropleth maps (lightgray -> gainsboro)
444
- - Testing experimental label_title support, to be documented in 1.44.0
445
-
446
- - 1.43.2
447
-
448
- - Fixed weird ymax in some baseline cases
449
- - Added bottom padding when baseline was below data-min
450
-
451
- - 1.43.1
452
-
453
- - Fixed cut off-bug with negative baseline
454
- - Fix coloring bug in warm_cold color_fn with baseline
455
- - Fix regression with quarterly locator
456
-
457
- - 1.43.0
458
-
459
- - Default to weekdays on x-axis if data spans 7 days or less
460
- - Added `.color_labels` to label bar colors set by `.color_fn`
461
-
462
- - 1.42.0
463
-
464
- - Added `.baseline` setting for bar charts
465
- - `warm_cold` coloring algorithm now works relative `.baseline`
466
- - Added `.baseline_annotation`
467
- - `.color_fn` can now be a lambda function (or the name of one of the built in functions), e.g. `chart.color_fn = lambda x: "red" if x < 1.4 else "green"`
468
- - Bar charts will now always have a small white edge
469
- - Don't break y axis if data is close to 0
470
- - Offset quarters will be recognosed as quarters now (e.g. Feb, May, Aug, Nov)
471
- - Fixed bug in .allow_broken_y_axis implementation, causing y-axis to be broken in too many places
472
- - Various dependency updates
473
- - Replaced deprecated PIL.Image.ANTIALIAS with PIL.Image.Resampling.LANCZOS for logotype resizing.
474
- - Get rid of warnings about missing “glyph 10” when prerendering text to calculate text bos sizes
475
- - Fixed bug where single values surrounded my None's were not printed out in serial-data line charts. This was an earlier regression that was not noticed for many releases.
476
-
477
- - 1.41.0
478
-
479
- - New, experimental chart type: Choropleth maps! Supports both categorical and continuous data.
480
- - Better support for monthly time series spanning years
481
- - Fixed bug where missing annotation slots could crash CategoricalChart
482
-
483
- - 1.40.2
484
-
485
- - Don't crash on deprecation warning
486
- - Matplotlib upgraded from 3.6.2 to 3.6.3
487
- - Pin some critical requirement versions
488
-
489
- - 1.40.1
490
-
491
- - Fix floating point bug in percent labels
492
- - Test fixes
493
-
494
- - 1.40.0
495
-
496
- - Auto-decide `.decimals` if None
497
- - Round 0.5 to 1, etc in value axis labels and annotations (the `ROUND_HALF_UP` behaviour)
498
- - Add `.force_decimals` to print out e.g. ”1.0”. Requires `.decimals` to be explicitly set
499
- - Serial Chart: Allow disabling ”broken y axis” feature by setting `allow_broken_y_axis=False`
500
- - Deprecated `units="count"`. Make all numbers equal. Use `units="number"` and `decimals=0` to get the earlier behaviour.
501
- - Remove overriding of decimal settings by units = count
502
- - Remove noisy deprecation warning on user settings in rc files
503
- - Formatters will now use the correct minus signs for the given locale.
504
-
505
- - 1.39.1
506
-
507
- - Added missing metadata to svg
508
- - Added .__version__ attribute to the package
509
-
510
- - 1.39.0
511
-
512
- - Added pdf export, now more widely used than eps
513
- - Author and software metadata now added to pdf and png, including the exakt NWCharts version used to produce an image
514
-
515
- - 1.38.2
516
-
517
- - `S3Storage`: Handle text files.
518
-
519
- - 1.38.1
520
-
521
- - Prevent logo from ever being > 155px, to restore previous behaviour.
522
-
523
- - 1.38.0
524
-
525
- - Made multi series bar seasonal bar charts work for opposite signs, so that we can make +/- charts
526
-
527
- - 1.37.3
528
-
529
- - Bug fix: Don't crash with factor argument in DW charts.
530
-
531
- - 1.37.2
532
-
533
- - Fixed rendering bug in non-transparent eps exports with transparent logos
534
-
535
- - 1.37.1
536
-
537
- - Fixed bug in argument parsing in S3Storage.save()
538
-
539
- - 1.37.0
540
-
541
- - Added `storage_options` argument to `render()` and `render_all()`
542
- - Unified function signatures across storage classes.
543
-
544
- - 1.36.0
545
-
546
- - Added options argument to `S3Storage.save()`
547
-
548
- - 1.35.0
549
-
550
- - Enable logo scaling. Provided logos can now be any size, and will be scaled down to an appopriate format.
551
-
552
- - 1.34.0
553
-
554
- - Adds `factor` argument to `.render()` and `.render_all()`.
555
- - Adds missing `transparent` argument to `.render_all()`.
556
- - Matplotlib @ 3.6.2
557
- - langcodes @ 3.3 to ensure consistent handling of macro languages (`no` is a valid language)
558
-
559
- - 1.33.0:
560
-
561
- - Adds `transparent` argument to render method.
562
-
563
- - 1.32.3
564
-
565
- - `ScatterPlot`: Mark labeled dots more clearly.
566
-
567
- - 1.32.2
568
-
569
- - `SerialChart`: Better error when timepoints are duplicated.
570
-
571
- - 1.32.1
572
-
573
- - Bug fixes: Handle negative values when `ymin=0` in SerialChart and remove line stroke from `highlighted_x_ranges`.
574
-
575
- - 1.32.0
576
-
577
- - `SerialChart`: New options: `line_width` and `highlighted_x_ranges`.
578
-
579
- - 1.31.0
580
-
581
- - Added `label_placement='outside'` option to SerialChart
582
-
583
- - 1.30.0
584
-
585
- - Matplotlib updated from 3.3 to 3.6, including among many, many other things:
586
- - support for .webp
587
- - a lot of additions and improvements to rcParams
588
- - new backends
589
- - Custom NWCharts parameters to the rc style file is being deprecated, and should eventually be phased out
590
- - Matplotlib and related modules are now pinned to a specific version
591
- - Added support for generating webp images!
592
- - Upgraded pytest to support Python 3.10+
593
- - Fixed date locators to use thecorrect langauge/locale
594
- - Added padding on top of title, to avoid cropping diactritics
595
-
596
- - 1.29.0
597
-
598
- - `CategoricalChart`: Make it possible to hide legend.
599
-
600
- - 1.28.1
601
-
602
- - `CategoricalChartWithReference`: Handle multi color bars.
603
-
604
- - 1.28.0
605
-
606
- - `Chart` / `SerialChart`: New feature: Mark broken y axis with symbol.
607
-
608
- - 1.27.1
609
-
610
- - `SerialChart`: Force y axis range to to given values when `ymax` and `ymin` is defined.
611
-
612
- - 1.27.0
613
-
614
- - `SerialChart`: Enable value labeling of each point on line.
615
-
616
- - 1.26.1
617
-
618
- - Highlight only current value in SeasonalChart; use different shades of grey for the rest
619
-
620
- - 1.26.0
621
-
622
- - Add `SeasonalChart`, a.k.a the Olsson chart
623
-
624
- - 1.25.3
625
-
626
- - ProgressChart: Handle missing values
627
- - `lib.formatter.Formatter`: Handle null values
628
-
629
- - 1.25.2
630
-
631
- - ScatterPlot: Enable ymin and xmin in scatterplot.
632
-
633
- - 1.25.1
634
-
635
- - Color annoation outline by background color.
636
-
637
- - 1.25.0
638
-
639
- - Improved ScatterPlot.
640
-
641
- - 1.24.1
642
-
643
- - Bug fix: Inline labeling on charts with missing data.
644
-
645
- - 1.24.0
646
-
647
- - CategoricalChartWithReference: Adds highlight option
648
-
649
- - 1.23.1
650
-
651
- - Adds missing dependency.
652
-
653
- - 1.23.0
654
-
655
- - SerialChart: Introduces inline labeling on lines
656
-
657
- - 1.22.1
658
-
659
- - Tweeks on line labeling
660
-
661
- - 1.22.0
662
-
663
- - SerialChart: Introduces labeling on lines (rather than just legends)
664
-
665
- - 1.21.5
666
-
667
- - Bug fix: Handle charts without ticks to be able to render pie charts again
668
-
669
- - 1.21.4
670
-
671
- - Beter height handling in header and footer.
672
- - Make Noto Sans default font.
673
-
674
- - 1.21.3
675
-
676
- - Enable colors property in stacked bar SerialChart.
677
-
678
- - 1.21.2
679
-
680
- - Adjusts x margin in RangePlot to fit value labels better.
681
- - Increases line spacing in subtitle.
682
-
683
- - 1.21.1
684
-
685
- - Bug fix: Small change in Datawrapper API.
686
- - Make ticks option work with SerialChart.init_from
687
-
688
- - 1.21.0
689
-
690
- - New feature: Use base `Chart` class to make custom charts.
691
- - Bug fix: Labels outside canvas in RangePlot
692
-
693
- - 1.20.2
694
-
695
- - ClimateCars: Tweeks on 2030 chart.
696
-
697
- - 1.20.1
698
-
699
- - Handle np.int as years.
700
-
701
- - 1.20.0
702
-
703
- - CategoricalChart: Highlight multiple values with list
704
- - Bug fix: ylabel placed outside canvas
705
- - Style: Align caption with note
706
-
707
- - 1.19.2
708
-
709
- - RangePlot: Better label margins and bold labels.
710
-
711
- - 1.19.1
712
-
713
- - RangePlot: Rename argument values_labels => value_labels.
714
-
715
-
716
- - 1.19.0
717
-
718
- - Pick up qualitative colors from style file.
719
-
720
- - 1.18.1
721
-
722
- - Fixed coloring on highlighted progress charts.
723
- - Adds ability to highlight both ends on range plot.
724
-
725
- - 1.18.0
726
-
727
- - Added `ticks` option to SerialChart, to set custom x-axis ticks
728
- - Added color option to CategoricalChart, to work exactly as in SerialChart
729
- - Fixed bug with highlight in line charts where some line was outside the highlighted date.
730
-
731
-
732
- - 1.17.0
733
-
734
- - Enable multiple targets in progress chart.
735
-
736
- - 1.16.2
737
-
738
- - Fixes highlight bug in progress chart.
739
-
740
- - 1.16.1
741
-
742
- - Small changes in range plot.
743
-
744
- - 1.16.0
745
-
746
- - Adds CO2 budget chart
747
-
748
- - 1.15.2
749
-
750
- - ClimateCar chart tweeks.
751
-
752
- - 1.15.1
753
-
754
- - Bug fix: Adds newsworthycharts.custom to build.
755
-
756
- - 1.15.0
757
-
758
- - Introduces progress charts and removes hard coded font sizes.
759
-
760
- - 1.14.0
761
-
762
- - Introduces range plots and enables custom coloring in serial charts.
763
-
764
- - 1.13.3
765
-
766
- - Fit long ticks on y axis.
767
-
768
- - 1.13.2
769
-
770
- - Set annotation fontsize to same as ticks by default.
771
-
772
- - 1.13.1
773
-
774
- - Bug fix: Subtitle placement
775
-
776
- - 1.13.0
777
-
778
- - Introduces subtitle and note.
779
- - Updates default styles to align with Newsworthy style guide.
780
-
781
-
782
- - 1.12.1
783
-
784
- - Fit footer by logo height. Fixes bug that caused axis overlag when logo was large.
785
-
786
- - 1.12.0
787
-
788
- - Introduces stacked categorical bar charts
789
-
790
- - 1.11.2
791
-
792
- - Bug fix: Remove failing attemt to store chart in dw format
793
-
794
-
795
- - 1.11.1
796
-
797
- - Corrects zorder and centers tick on CategoricalChartWithReference
798
-
799
- - 1.11.0
800
-
801
- - Introduces new chart: CategoricalChartWithReference
802
-
803
- - 1.10.1
804
-
805
- - Fixes bad X ticks in weekly SerialChart (and charts that don't start in January).
806
-
807
- - 1.10.0
808
-
809
- - Add annotation_rotation option to categorical charts
810
- - Fix a crash in some special cases with serial charts shorter than a year.
811
- - Fix a bug where diff between series was not highlighted if one value was close to zero.
812
-
813
- - 1.9.2
814
-
815
- - Include translations in build.
816
-
817
- - 1.9.1
818
-
819
- - Translates region to Datawrapper standard when making maps.
820
-
821
- - 1.9.0
822
-
823
- - Allows list of dicts to be passed to DatawrapperChart to be make tables, categorical maps etc.
824
-
825
- - 1.8.2
826
-
827
- - Require requests.
828
-
829
- - 1.8.1
830
-
831
- - Bug fixes.
832
-
833
- - 1.8.0
834
-
835
- - Introduces Datawrapper Chart type.
836
-
837
- - 1.7.0
838
-
839
- - Adds ymax argument (to SerialChart)
840
- - Bug fix: Handle missing values in SerialChart with line.
841
-
842
- - 1.6.12
843
-
844
- - Bug fix: Set y max to stacked max in stacked bar chart.
845
-
846
- - 1.6.11
847
-
848
- - Introduces stacked bars to SerialChart.
849
-
850
- - 1.6.10
851
-
852
- - Fixes bar_orientation bug with `init_from()`
853
-
854
- - 1.6.9
855
-
856
- - Fix an ugly bug where type=line would not work with `init_from()`
857
-
858
- - 1.6.8
859
-
860
- - Some cosmetic changes: no legend if only one series, color updates, thinner zero line.
861
-
862
-
863
- - 1.6.7
864
-
865
- - Make title and units work with `init_from` again
866
-
867
- - 1.6.6
868
-
869
- - Add warm/cold color function
870
-
871
- - 1.6.5
872
-
873
- - Really, really make `init_from` work, by allowingly allowing allowed attributes
874
-
875
- - 1.6.4
876
-
877
- - Fix bug where `init_from` would sometime duplicate data.
878
- - Make sure `init_from` does not overwrite class methods.
879
-
880
- - 1.6.3
881
-
882
- - Protect private properties from being overwritten by `init_from`
883
- - When `units` is count, `decimal` should default to 0 if not provided. This sometimes didn't work. Now it does.
884
-
885
- - 1.6.2
886
-
887
- - Make `init_from` work as expected with a language argument
888
-
889
- - 1.6.1
890
-
891
- - Make `init_from` work as expected with multiple data series
892
-
893
- - 1.6.0
894
-
895
- - Added a factory method to create charts from a JSON-like Python object, like so: `SerialChart.init_from(config, storage)`
896
-
897
- - 1.5.1
898
-
899
- - Fix packaging error in 1.5.0
900
-
901
- - 1.5.0
902
-
903
- - Expose available chart engines in `CHART_ENGINES` constant for dynamic loading
904
- - Add `color_fn` property, for coloring bars based on value
905
- - Increase line width in default style
906
- - Upgrading Numpy could potentially affect how infinity is treated in serial charts.
907
-
908
- - 1.4.1
909
-
910
- - Revert text adjusting for categorical charts, as it had issues
911
-
912
- - 1.4.0
913
-
914
- - Add new ScatterPlot chart class
915
- - Improved text adjusting in serial charts
916
- - More secure YAML file parsing
917
-
918
- - 1.3.3
919
-
920
- - Make small bar charts with very many bars look better
921
-
922
- - 1.3.2
923
-
924
- - Make labels work again, 1.3.1 broke those in some circumstances
925
-
926
- - 1.3.1
927
-
928
- - Make inner_max/min_x work with leading / trailing None values
929
- - Make sure single, orphaned values are visible (as points) in line charts
930
-
931
- - 1.3.0
932
-
933
- - Allow (and recommend) using Matplotlib 3. This may affect how some charts are rendered.
934
- - Removed undocumented and incomplete Latex support from caption.
935
- - Don't highlight diff outside either series' extreme ends.
936
-
937
- - 1.2.1
938
-
939
- - Use strong color if there is nothing to highlight.
940
-
941
- - 1.2.0
942
-
943
- - Fix a bug where `decimals` setting was not used in all annotations. Potentially breaking in some implementations.
944
- - Make the annotation offset 80% of the fontsize (used to be a hardcoded number of pixels)
945
-
946
- - 1.1.5
947
-
948
- - Small cosmetic update: Decrease offset of annotation.
949
-
950
- - 1.1.4
951
-
952
- - Require Matplotlib < 3, because we are still relying on some features that are deprecated there. Also, internal changes to Matplot lib may cause some charts to look different depending on version.
953
-
954
- - 1.1.3
955
-
956
- - Make annotation use default font size, as relative sizing didn't work here anyway
957
-
958
- - 1.1.2
959
-
960
- - Move class properties to method properties to make sure multiple Chart instances work as intended/documented. This will make tests run again.
961
- - None values in bar charts are not annotated (trying to annotate None values used to result in a crash)
962
- - More tests
963
-
964
- - 1.1.1
965
-
966
- - Annotations should now work as expected on series with missing data
967
-
968
- - 1.1.0
969
-
970
- - Fix bug where decimal setting wasn't always respected
971
- - Make no decimals the default if unit is "count"
972
-
973
- - 1.0.0
974
-
975
- - First version