~ubuntu-branches/ubuntu/utopic/python-chaco/utopic

« back to all changes in this revision

Viewing changes to chaco/base_xy_plot.py

  • Committer: Package Import Robot
  • Author(s): Andrew Starr-Bochicchio
  • Date: 2014-06-01 17:04:08 UTC
  • mfrom: (7.2.5 sid)
  • Revision ID: package-import@ubuntu.com-20140601170408-m86xvdjd83a4qon0
Tags: 4.4.1-1ubuntu1
* Merge from Debian unstable. Remaining Ubuntu changes:
 - Let the binary-predeb target work on the usr/lib/python* directory
   as we don't have usr/share/pyshared anymore.

Show diffs side-by-side

added added

removed removed

Lines of Context:
207
207
        plot.
208
208
 
209
209
        Parameters
210
 
        ==========
 
210
        ----------
211
211
        screen_pt : (x,y)
212
212
            A point to test.
213
213
        threshold : integer
214
214
            Optional maximum screen space distance (pixels) between
215
215
            *screen_pt* and the plot.
216
216
        return_distance : Boolean
217
 
            If True, returns the distance.
 
217
            If True, also return the distance.
218
218
 
219
219
        Returns
220
 
        =======
 
220
        -------
221
221
        If self.hittest_type is 'point', then this method returns the screen
222
222
        coordinates of the closest point on the plot as a tuple (x,y)
223
223
 
227
227
 
228
228
        If *screen_pt* does not fall within *threshold* of the plot, then this
229
229
        method returns None.
 
230
 
 
231
        If return_distance is True, return the (x, y, d), where d is the
 
232
        distance between the distance between the input point and
 
233
        the closest point (x, y), in screen coordinates.
230
234
        """
231
235
        if self.hittest_type == "point":
232
236
            tmp = self.get_closest_point(screen_pt, threshold)
250
254
        them; to do the latter use get_closest_line() instead.
251
255
 
252
256
        Parameters
253
 
        ==========
 
257
        ----------
254
258
        screen_pt : (x,y)
255
259
            A point to test.
256
260
        threshold : integer
259
263
            are performed, and the nearest point is returned.
260
264
 
261
265
        Returns
262
 
        =======
 
266
        -------
263
267
        (x, y, distance) of a datapoint nearest to *screen_pt*.
264
268
        If no data points are within *threshold* of *screen_pt*, returns None.
265
269
        """
276
280
        points in this plot's dataset.
277
281
 
278
282
        Parameters
279
 
        ==========
 
283
        ----------
280
284
        screen_pt : (x,y)
281
285
            A point to test.
282
286
        threshold : integer
285
289
            line regardless of distance from the plot.
286
290
 
287
291
        Returns
288
 
        =======
 
292
        -------
289
293
        (x1, y1, x2, y2, dist) of the endpoints of the line segment
290
294
        closest to *screen_pt*.  The *dist* element is the perpendicular
291
295
        distance from *screen_pt* to the line.  If there is only a single point
361
365
                x, y = y, x
362
366
        if all_values:
363
367
            return array((self.index_mapper.map_data(x),
364
 
                      self.value_mapper.map_data(y)))
 
368
                          self.value_mapper.map_data(y)))
365
369
        else:
366
370
            return self.index_mapper.map_data(x)
367
371