marsilea 0.3.6__py3-none-any.whl → 0.4.0__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.
marsilea/__init__.py CHANGED
@@ -1,6 +1,6 @@
1
1
  """Declarative creation of composable visualization"""
2
2
 
3
- __version__ = "0.3.6"
3
+ __version__ = "0.4.0"
4
4
 
5
5
  import marsilea.plotter as plotter
6
6
  from ._deform import Deformation
marsilea/base.py CHANGED
@@ -67,21 +67,22 @@ class LegendMaker:
67
67
  """
68
68
  raise NotImplementedError("Should be implemented in derived class")
69
69
 
70
- def custom_legend(self, legend, name=None):
70
+ def custom_legend(self, legend_func, name=None):
71
71
  """Add a custom legend
72
72
 
73
73
  Parameters
74
74
  ----------
75
75
 
76
- legend : `Artist <matplotlib.artist.Artists>`
77
- A legend object
76
+ legend_func : Callable
77
+ A function that return the legend object,
78
+ the legend must be an `Artist <matplotlib.artist.Artists>`
78
79
  name : str, optional
79
80
  The name of the legend
80
81
 
81
82
  """
82
83
  if name is None:
83
84
  name = str(uuid4())
84
- self._user_legends[name] = [legend]
85
+ self._user_legends[name] = legend_func
85
86
 
86
87
  def add_legends(
87
88
  self,
@@ -159,7 +160,8 @@ class LegendMaker:
159
160
  self.layout.remove_legend_ax()
160
161
 
161
162
  def _legends_drawer(self, ax):
162
- legends = {**self.get_legends(), **self._user_legends}
163
+ user_legends = {k: [v()] for k, v in self._user_legends.items()}
164
+ legends = {**self.get_legends(), **user_legends}
163
165
 
164
166
  # force to remove all legends before drawing
165
167
  # In case some legends are added implicitly
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: marsilea
3
- Version: 0.3.6
3
+ Version: 0.4.0
4
4
  Summary: Declarative creation of composable visualization
5
5
  Author: Zhihang Zheng
6
6
  Author-email: Mr-Milk <yzheng@cemm.at>
@@ -1,7 +1,7 @@
1
- marsilea/__init__.py,sha256=TJ1LRb_ML9gOV-uhUijRCVqEkCZkrCk0MFgrmB5z574,541
1
+ marsilea/__init__.py,sha256=6yq4oaMr8fCKXwXWnyZ-mKf2-HU-P_1yQgmPJViUIaU,541
2
2
  marsilea/_api.py,sha256=tymWZHfjhx8-0NNd9762znfdIu36NrARRweEIr5L1mA,283
3
3
  marsilea/_deform.py,sha256=SKXLvhyUrwTRAw7Fl--OpupDLk6T3S5DRfwCAdewHQs,14138
4
- marsilea/base.py,sha256=wgKuOp8GKttwqC6_YdtR7RzFdxbOc-7iVjTlY0T0h44,46192
4
+ marsilea/base.py,sha256=ouHt55C_KbeN_R6p6-I0_F3CDv5LSOtW9IKVd9mvbVo,46341
5
5
  marsilea/dataset.py,sha256=a0mXjPu9_tRGHofnnQaTryFpxftkfqldq_ZLXMSBf7A,4410
6
6
  marsilea/dendrogram.py,sha256=WUnV2JMSY9mPt1sfkFAEikkl2ta7xHFD13teas_iZgE,14767
7
7
  marsilea/exceptions.py,sha256=Wxy31eCWkoXTPwqaa7R5F7cJ3uCtzqhJXmxVqqX8eAA,661
@@ -21,7 +21,7 @@ marsilea/plotter/base.py,sha256=0UiJqNefv9mieMB0ICpKQ2rXqGaFYigqyxQe4BzBP24,2032
21
21
  marsilea/plotter/bio.py,sha256=_pZkGoAei7eirFCpu7AcZJhebBneNjUKcZlI36bpqUE,5044
22
22
  marsilea/plotter/mesh.py,sha256=ArioOXZJpD1T2wrYDmm_cFQpUmq_3q7W_qrJ_zCX3zU,23793
23
23
  marsilea/plotter/text.py,sha256=oYJ5py3_nGHKi60DSVzFgPg4drnTSTw__IcYs0cut4M,36222
24
- marsilea-0.3.6.dist-info/LICENSE,sha256=2TLD8FnLJqXzg8YBRs7W3VZBwfWfp4ArDfBl-rn96Qc,1074
25
- marsilea-0.3.6.dist-info/WHEEL,sha256=EZbGkh7Ie4PoZfRQ8I0ZuP9VklN_TvcZ6DSE5Uar4z4,81
26
- marsilea-0.3.6.dist-info/METADATA,sha256=COXhGBcv1dJZ9uI_TuMX3FV5dun7yTkAkw0orGCeFjQ,4074
27
- marsilea-0.3.6.dist-info/RECORD,,
24
+ marsilea-0.4.0.dist-info/LICENSE,sha256=2TLD8FnLJqXzg8YBRs7W3VZBwfWfp4ArDfBl-rn96Qc,1074
25
+ marsilea-0.4.0.dist-info/WHEEL,sha256=EZbGkh7Ie4PoZfRQ8I0ZuP9VklN_TvcZ6DSE5Uar4z4,81
26
+ marsilea-0.4.0.dist-info/METADATA,sha256=1D7C_hcPfQ1nGkNOVnLkqg04gsumrAsjU4nf5U4pZaU,4074
27
+ marsilea-0.4.0.dist-info/RECORD,,