newsworthycharts 1.70.0__py3-none-any.whl → 1.70.2__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.70.0"
1
+ __version__ = "1.70.2"
2
2
 
3
3
  from .chart import Chart
4
4
  from .choroplethmap import ChoroplethMap
newsworthycharts/chart.py CHANGED
@@ -556,10 +556,10 @@ class Chart(object):
556
556
  if len(ticks_) <= 1 and self.data:
557
557
  self.value_axis.set_ticks([0, self.data.max_val])
558
558
 
559
- # Special handling for stacked percents, where, we want to fix any rounding errors,
560
- # to make sure value max is 100 %, and not something like 100.00000000000001 (which
561
- # may cause an extra tick to show up
562
559
  if self.units == "percent" and self.values_will_be_stacked:
560
+ # Special handling for stacked percents, where, we want to fix any rounding errors,
561
+ # to make sure value max is 100 %, and not something like 100.00000000000001 (which
562
+ # may cause an extra tick to show up
563
563
  max_val = max(self.data.stacked_values)
564
564
  diff = abs(1 - max_val)
565
565
  _decimals = self.decimals if self.decimals is not None else 2
@@ -569,6 +569,15 @@ class Chart(object):
569
569
  self.ax.set_ylim(value_lim[0], 1)
570
570
  else:
571
571
  self.ax.set_xlim(value_lim[0], 1)
572
+ elif self.units == "percent":
573
+ # Cut y axis at 100 percent if not value is above
574
+ value_lim = self.ax.get_ylim() if value_axis == "_y" else self.ax.get_xlim()
575
+ if self.data.max_val <= 1 and value_lim[1] > 1:
576
+ value_lim = self.ax.get_ylim() if value_axis == "_y" else self.ax.get_xlim()
577
+ if value_axis == "_y":
578
+ self.ax.set_ylim(value_lim[0], 1)
579
+ else:
580
+ self.ax.set_xlim(value_lim[0], 1)
572
581
 
573
582
  for a in self.annotations:
574
583
  self._annotate_point(a["text"], a["xy"], a["direction"])
@@ -651,7 +660,7 @@ class Chart(object):
651
660
  # ticks labels
652
661
  tick_label_height
653
662
  # some padding
654
- + 15 / self._h
663
+ + 30 / self._h
655
664
  # chart notes (if any)
656
665
  + self._note_rel_height
657
666
  # chart caption and logo (if any)
@@ -850,7 +859,7 @@ class Chart(object):
850
859
  if self._title_elem:
851
860
  rel_height += self._text_rel_height(self._title_elem)
852
861
  # Adds a fixed margin below
853
- rel_height += 0.008
862
+ rel_height += 30 / self._h
854
863
  return rel_height
855
864
 
856
865
  @property
@@ -859,8 +868,8 @@ class Chart(object):
859
868
  if self._subtitle_elem:
860
869
  rel_height += self._text_rel_height(self._subtitle_elem)
861
870
  # Adds a fixed margin below
862
- rel_height += 0.012
863
- # rel_height += 15 / self._h
871
+ # rel_height += 0.012
872
+ rel_height += 15 / self._h
864
873
  return rel_height
865
874
 
866
875
  @property
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: newsworthycharts
3
- Version: 1.70.0
3
+ Version: 1.70.2
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.70.0.tar.gz
6
+ Download-URL: https://github.com/jplusplus/newsworthycharts/archive/1.70.2.tar.gz
7
7
  Author: Jens Finnäs and Leo Wallentin, J++ Stockholm
8
8
  Author-email: stockholm@jplusplus.org
9
9
  License: MIT
@@ -167,7 +167,7 @@ These settings are available for all chart types:
167
167
  - value_labels = False # Print out values at points on line?
168
168
  - highlighted_x_ranges = [] # List of tuples with start and end of highlighted areas
169
169
  - x_range_labels = [] # List of labels for highlighted areas
170
- - label_placement = "legend" # legend|inline|outside|line
170
+ - label_placement = "legend" # legend|inline|outside|line|none
171
171
  - color_labels = None # A dictionary of label/color, to override style colors
172
172
 
173
173
  **SeasonalChart**
@@ -186,6 +186,7 @@ _ Inherits from SerialChart _
186
186
  - legend = True
187
187
  - stacked = False
188
188
  - type = "bars" # [bars|pie]
189
+ - label_placement = "legend" # legend|outside|none
189
190
 
190
191
  **CategoricalChartWithReference**
191
192
 
@@ -260,6 +261,15 @@ Roadmap
260
261
  Changelog
261
262
  ---------
262
263
 
264
+ - 1.70.2
265
+
266
+ - Fix edge case bug in y axis cutoff logic
267
+
268
+ - 1.70.1
269
+
270
+ - Make sure y axis is cut at 100 % unless we are really, really certain it should be higher
271
+ - Revert some more padding changes from 1.65.2 and 1.65.3
272
+
263
273
  - 1.70.0
264
274
 
265
275
  - Pillow==11.1.0 (possibly faster png rendering)
@@ -1,7 +1,7 @@
1
- newsworthycharts/__init__.py,sha256=MxUuXTGoHiIb02qpqT9Sdp9MPvODq0VTPVJSU_qw4o4,1160
1
+ newsworthycharts/__init__.py,sha256=wRQAtMtzNzN2_8aMN6-JPjSE44gy1ZL53OyXh4BNvtQ,1160
2
2
  newsworthycharts/bubblemap.py,sha256=nkocWmpiFgfjEuJGAsthjY5X7Q56jXWsZHUGXw4PwgE,2587
3
3
  newsworthycharts/categoricalchart.py,sha256=YL3pzq8a7U5F0MpeRIAEwCAHw1BRDyKjoaAhf-UyRDo,18179
4
- newsworthycharts/chart.py,sha256=jurOkIrm8TRpuL-Fj0AdBJXmjrdkZ-U2w_TaOysQvAs,34489
4
+ newsworthycharts/chart.py,sha256=gAMCXLtQkhOzu93QxeR5GgcoGVEnGddzFgubzsBeZ8Y,35055
5
5
  newsworthycharts/choroplethmap.py,sha256=Si-01213rWqDKINkhmKV6x5iSMumQveJfrlCnqYcIJM,8173
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.70.0.dist-info/LICENSE.txt,sha256=Sq6kGICrehbhC_FolNdXf0djKjTpv3YqjFCIYsxdQN4,1069
32
- newsworthycharts-1.70.0.dist-info/METADATA,sha256=0Silk18RHi0iuiE-fvwDJhTMFeZFNuildojkWY3Of4w,31811
33
- newsworthycharts-1.70.0.dist-info/WHEEL,sha256=cVxcB9AmuTcXqmwrtPhNK88dr7IR_b6qagTj0UvIEbY,91
34
- newsworthycharts-1.70.0.dist-info/top_level.txt,sha256=dn_kzIj8UgUCMsh1PHdVEQJHVGSsN7Z8YJF-8xXa8n0,17
35
- newsworthycharts-1.70.0.dist-info/RECORD,,
31
+ newsworthycharts-1.70.2.dist-info/LICENSE.txt,sha256=Sq6kGICrehbhC_FolNdXf0djKjTpv3YqjFCIYsxdQN4,1069
32
+ newsworthycharts-1.70.2.dist-info/METADATA,sha256=sGu65_A1eTrUDLhtVkIjrMaGBbdjehSwSBI_RoYr6E0,32089
33
+ newsworthycharts-1.70.2.dist-info/WHEEL,sha256=cVxcB9AmuTcXqmwrtPhNK88dr7IR_b6qagTj0UvIEbY,91
34
+ newsworthycharts-1.70.2.dist-info/top_level.txt,sha256=dn_kzIj8UgUCMsh1PHdVEQJHVGSsN7Z8YJF-8xXa8n0,17
35
+ newsworthycharts-1.70.2.dist-info/RECORD,,