plotnine 0.14.5__py3-none-any.whl → 0.15.0.dev2__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.
Files changed (64) hide show
  1. plotnine/__init__.py +31 -37
  2. plotnine/_mpl/gridspec.py +265 -0
  3. plotnine/_mpl/layout_manager/__init__.py +6 -0
  4. plotnine/_mpl/layout_manager/_engine.py +87 -0
  5. plotnine/_mpl/layout_manager/_layout_items.py +916 -0
  6. plotnine/_mpl/layout_manager/_layout_tree.py +625 -0
  7. plotnine/_mpl/layout_manager/_spaces.py +1007 -0
  8. plotnine/_mpl/patches.py +1 -1
  9. plotnine/_mpl/text.py +59 -24
  10. plotnine/_mpl/utils.py +78 -10
  11. plotnine/_utils/__init__.py +5 -5
  12. plotnine/_utils/dev.py +45 -27
  13. plotnine/animation.py +1 -1
  14. plotnine/coords/coord_trans.py +1 -1
  15. plotnine/data/__init__.py +12 -8
  16. plotnine/doctools.py +1 -1
  17. plotnine/facets/facet.py +30 -39
  18. plotnine/facets/facet_grid.py +14 -6
  19. plotnine/facets/facet_wrap.py +3 -5
  20. plotnine/facets/strips.py +7 -9
  21. plotnine/geoms/geom_crossbar.py +2 -3
  22. plotnine/geoms/geom_path.py +1 -1
  23. plotnine/ggplot.py +94 -65
  24. plotnine/guides/guide.py +12 -10
  25. plotnine/guides/guide_colorbar.py +3 -3
  26. plotnine/guides/guide_legend.py +12 -13
  27. plotnine/guides/guides.py +3 -3
  28. plotnine/iapi.py +5 -2
  29. plotnine/labels.py +5 -0
  30. plotnine/mapping/aes.py +4 -3
  31. plotnine/options.py +14 -7
  32. plotnine/plot_composition/__init__.py +10 -0
  33. plotnine/plot_composition/_compose.py +436 -0
  34. plotnine/plot_composition/_plotspec.py +50 -0
  35. plotnine/plot_composition/_spacer.py +32 -0
  36. plotnine/positions/position_dodge.py +1 -1
  37. plotnine/positions/position_dodge2.py +1 -1
  38. plotnine/positions/position_stack.py +1 -2
  39. plotnine/qplot.py +1 -2
  40. plotnine/scales/__init__.py +0 -6
  41. plotnine/scales/scale.py +1 -1
  42. plotnine/stats/binning.py +1 -1
  43. plotnine/stats/smoothers.py +3 -5
  44. plotnine/stats/stat_density.py +1 -1
  45. plotnine/stats/stat_qq_line.py +1 -1
  46. plotnine/stats/stat_sina.py +1 -1
  47. plotnine/themes/elements/__init__.py +2 -0
  48. plotnine/themes/elements/element_text.py +35 -24
  49. plotnine/themes/elements/margin.py +73 -60
  50. plotnine/themes/targets.py +3 -1
  51. plotnine/themes/theme.py +13 -7
  52. plotnine/themes/theme_gray.py +28 -31
  53. plotnine/themes/theme_matplotlib.py +25 -28
  54. plotnine/themes/theme_seaborn.py +31 -34
  55. plotnine/themes/theme_void.py +17 -26
  56. plotnine/themes/themeable.py +290 -157
  57. {plotnine-0.14.5.dist-info → plotnine-0.15.0.dev2.dist-info}/METADATA +4 -3
  58. {plotnine-0.14.5.dist-info → plotnine-0.15.0.dev2.dist-info}/RECORD +61 -54
  59. {plotnine-0.14.5.dist-info → plotnine-0.15.0.dev2.dist-info}/WHEEL +1 -1
  60. plotnine/_mpl/_plot_side_space.py +0 -888
  61. plotnine/_mpl/_plotnine_tight_layout.py +0 -293
  62. plotnine/_mpl/layout_engine.py +0 -110
  63. {plotnine-0.14.5.dist-info → plotnine-0.15.0.dev2.dist-info/licenses}/LICENSE +0 -0
  64. {plotnine-0.14.5.dist-info → plotnine-0.15.0.dev2.dist-info}/top_level.txt +0 -0
@@ -1,5 +1,11 @@
1
1
  from ..options import get_option
2
- from .elements import element_blank, element_line, element_rect, element_text
2
+ from .elements import (
3
+ element_blank,
4
+ element_line,
5
+ element_rect,
6
+ element_text,
7
+ margin,
8
+ )
3
9
  from .theme import theme
4
10
 
5
11
 
@@ -49,22 +55,22 @@ class theme_seaborn(theme):
49
55
  text=element_text(size=base_size, rotation=0, margin={}),
50
56
  axis_text=element_text(
51
57
  size=base_size * 0.8,
52
- margin={
53
- "t": line_margin,
54
- "b": line_margin,
55
- "l": line_margin,
56
- "r": line_margin,
57
- "units": "pt",
58
- },
58
+ margin=margin(
59
+ t=line_margin,
60
+ b=line_margin,
61
+ l=line_margin,
62
+ r=line_margin,
63
+ unit="pt",
64
+ ),
59
65
  ),
60
66
  axis_title_x=element_text(
61
- va="bottom", ha="center", margin={"t": m, "units": "fig"}
67
+ va="bottom", ha="center", margin=margin(t=m, unit="fig")
62
68
  ),
63
69
  axis_title_y=element_text(
64
70
  angle=90,
65
71
  va="center",
66
72
  ha="left",
67
- margin={"r": m, "units": "fig"},
73
+ margin=margin(r=m, unit="fig"),
68
74
  ),
69
75
  legend_box_margin=0,
70
76
  legend_box_spacing=m * 3, # figure units
@@ -77,23 +83,11 @@ class theme_seaborn(theme):
77
83
  legend_position="right",
78
84
  legend_spacing=10, # points
79
85
  legend_text=element_text(
80
- margin={
81
- "t": m / 1.5,
82
- "b": m / 1.5,
83
- "l": m / 1.5,
84
- "r": m / 1.5,
85
- "units": "fig",
86
- },
86
+ margin=margin(m / 1.5, m / 1.5, m / 1.5, m / 1.5, "fig")
87
87
  ),
88
88
  legend_ticks=element_line(color="#CCCCCC", size=1),
89
89
  legend_title=element_text(
90
- margin={
91
- "t": m,
92
- "b": m / 2,
93
- "l": m * 2,
94
- "r": m * 2,
95
- "units": "fig",
96
- },
90
+ margin=margin(t=m, l=m * 2, b=m / 2, r=m * 2, unit="fig")
97
91
  ),
98
92
  panel_spacing=m,
99
93
  plot_caption=element_text(
@@ -101,33 +95,36 @@ class theme_seaborn(theme):
101
95
  ha="right",
102
96
  va="bottom",
103
97
  ma="left",
104
- margin={"t": m, "units": "fig"},
98
+ margin=margin(t=m, unit="fig"),
105
99
  ),
106
100
  plot_margin=m,
107
101
  plot_subtitle=element_text(
108
102
  size=base_size * 1,
109
103
  va="top",
110
104
  ma="left",
111
- margin={"b": m, "units": "fig"},
105
+ margin=margin(b=m, unit="fig"),
112
106
  ),
113
107
  plot_title=element_text(
114
108
  size=base_size * 1.2,
115
109
  va="top",
116
110
  ma="left",
117
- margin={"b": m, "units": "fig"},
111
+ margin=margin(b=m, unit="fig"),
118
112
  ),
113
+ plot_tag=element_text(
114
+ size=base_size * 1.2,
115
+ va="center",
116
+ ha="center",
117
+ ),
118
+ plot_title_position="panel",
119
+ plot_caption_position="panel",
120
+ plot_tag_location="margin",
121
+ plot_tag_position="topleft",
119
122
  strip_align=0,
120
123
  strip_background=element_rect(color="none", fill="#D1CDDF"),
121
124
  strip_text=element_text(
122
125
  size=base_size * 0.8,
123
126
  linespacing=1.0,
124
- margin={
125
- "t": 1 / 3,
126
- "b": 1 / 3,
127
- "l": 1 / 3,
128
- "r": 1 / 3,
129
- "units": "lines",
130
- },
127
+ margin=margin(1 / 3, 1 / 3, 1 / 3, 1 / 3, "lines"),
131
128
  ),
132
129
  strip_text_y=element_text(rotation=-90),
133
130
  complete=True,
@@ -1,5 +1,5 @@
1
1
  from ..options import get_option
2
- from .elements import element_blank, element_line, element_text
2
+ from .elements import element_blank, element_line, element_text, margin
3
3
  from .theme import theme
4
4
 
5
5
 
@@ -32,7 +32,7 @@ class theme_void(theme):
32
32
  size=base_size,
33
33
  linespacing=0.9,
34
34
  rotation=0,
35
- margin={},
35
+ margin=margin(),
36
36
  ),
37
37
  axis_text_x=element_blank(),
38
38
  axis_text_y=element_blank(),
@@ -54,23 +54,11 @@ class theme_void(theme):
54
54
  legend_spacing=10,
55
55
  legend_text=element_text(
56
56
  size=base_size * 0.8,
57
- margin={
58
- "t": m / 1.5,
59
- "b": m / 1.5,
60
- "l": m / 1.5,
61
- "r": m / 1.5,
62
- "units": "fig",
63
- },
57
+ margin=margin(m / 1.5, m / 1.5, m / 1.5, m / 1.5, "fig"),
64
58
  ),
65
59
  legend_ticks=element_line(color="#CCCCCC", size=1),
66
60
  legend_title=element_text(
67
- margin={
68
- "t": m,
69
- "b": m / 2,
70
- "l": m * 2,
71
- "r": m * 2,
72
- "units": "fig",
73
- },
61
+ margin=margin(t=m, l=m * 2, b=m / 2, r=m * 2, unit="fig")
74
62
  ),
75
63
  panel_spacing=m,
76
64
  plot_caption=element_text(
@@ -78,33 +66,36 @@ class theme_void(theme):
78
66
  ha="right",
79
67
  va="bottom",
80
68
  ma="left",
81
- margin={"t": m, "units": "fig"},
69
+ margin=margin(t=m, unit="fig"),
82
70
  ),
83
71
  plot_margin=0,
84
72
  plot_subtitle=element_text(
85
73
  size=base_size * 1,
86
74
  va="top",
87
75
  ma="left",
88
- margin={"b": m, "units": "fig"},
76
+ margin=margin(b=m, unit="fig"),
89
77
  ),
90
78
  plot_title=element_text(
91
79
  size=base_size * 1.2,
92
80
  va="top",
93
81
  ma="left",
94
- margin={"b": m, "units": "fig"},
82
+ margin=margin(b=m, unit="fig"),
95
83
  ),
84
+ plot_tag=element_text(
85
+ size=base_size * 1.2,
86
+ va="center",
87
+ ha="center",
88
+ ),
89
+ plot_title_position="panel",
90
+ plot_caption_position="panel",
91
+ plot_tag_location="margin",
92
+ plot_tag_position="topleft",
96
93
  strip_align=0,
97
94
  strip_text=element_text(
98
95
  color="#1A1A1A",
99
96
  size=base_size * 0.8,
100
97
  linespacing=1.0,
101
- margin={
102
- "t": 1 / 3,
103
- "b": 1 / 3,
104
- "l": 1 / 3,
105
- "r": 1 / 3,
106
- "units": "lines",
107
- },
98
+ margin=margin(1 / 3, 1 / 3, 1 / 3, 1 / 3, "lines"),
108
99
  ),
109
100
  complete=True,
110
101
  )