From ea94a7a3a0491af89151babd42bc3bb7ffff0214 Mon Sep 17 00:00:00 2001 From: Jonathan Rocher Date: Thu, 8 Mar 2018 20:32:44 -0600 Subject: [PATCH 1/2] Add see also in docstring for set_data pointing to update_data. Replace copy-pasta docstring in update_data by something more accurate. --- chaco/array_plot_data.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/chaco/array_plot_data.py b/chaco/array_plot_data.py index c487adec8..297ae508d 100644 --- a/chaco/array_plot_data.py +++ b/chaco/array_plot_data.py @@ -122,6 +122,10 @@ def set_data(self, name, new_data, generate_name=False): ------- The name under which the array was set. + See Also + -------- + update_data: Use if needing to set multiple ArrayPlotData entries at + once, for example because their dimension changes. """ if not self.writable: return None @@ -135,12 +139,15 @@ def set_data(self, name, new_data, generate_name=False): def update_data(self, *args, **kwargs): - """ Sets the specified array as the value for either the specified - name or a generated name. + """ Updates any number of arrays before triggering a `data_changed` + event. Implements AbstractPlotData's update_data() method. This method has the same signature as the dictionary update() method. + See Also + -------- + set_data: Simpler interface to set only 1 entry at a time. """ if not self.writable: return None From 4f3ead087f98af32529c0b2a507c08feb4c6755f Mon Sep 17 00:00:00 2001 From: Jonathan Rocher Date: Thu, 8 Mar 2018 20:38:06 -0600 Subject: [PATCH 2/2] More details for update_data. --- chaco/array_plot_data.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/chaco/array_plot_data.py b/chaco/array_plot_data.py index 297ae508d..0dd04378d 100644 --- a/chaco/array_plot_data.py +++ b/chaco/array_plot_data.py @@ -125,7 +125,8 @@ def set_data(self, name, new_data, generate_name=False): See Also -------- update_data: Use if needing to set multiple ArrayPlotData entries at - once, for example because their dimension changes. + once, for example because new arrays' dimensions change and + updating one at a time would break an existing Plot. """ if not self.writable: return None @@ -142,8 +143,12 @@ def update_data(self, *args, **kwargs): """ Updates any number of arrays before triggering a `data_changed` event. - Implements AbstractPlotData's update_data() method. This method has - the same signature as the dictionary update() method. + Useful to set multiple ArrayPlotData entries at once, for example + because new arrays' dimensions change and updating one at a time would + break an existing Plot. + + Note: Implements AbstractPlotData's update_data() method. This method + has the same signature as the dictionary update() method. See Also --------