Figures out the data limit of the given line, updating `.Axes.dataLim`.
(self, line)
| 2491 | return True |
| 2492 | |
| 2493 | def _update_line_limits(self, line): |
| 2494 | """ |
| 2495 | Figures out the data limit of the given line, updating `.Axes.dataLim`. |
| 2496 | """ |
| 2497 | path = line.get_path() |
| 2498 | if path.vertices.size == 0: |
| 2499 | return |
| 2500 | |
| 2501 | line_trf = line.get_transform() |
| 2502 | |
| 2503 | if line_trf == self.transData: |
| 2504 | data_path = path |
| 2505 | elif any(line_trf.contains_branch_separately(self.transData)): |
| 2506 | # Compute the transform from line coordinates to data coordinates. |
| 2507 | trf_to_data = line_trf - self.transData |
| 2508 | # If transData is affine we can use the cached non-affine component |
| 2509 | # of line's path (since the non-affine part of line_trf is |
| 2510 | # entirely encapsulated in trf_to_data). |
| 2511 | if self.transData.is_affine: |
| 2512 | line_trans_path = line._get_transformed_path() |
| 2513 | na_path, _ = line_trans_path.get_transformed_path_and_affine() |
| 2514 | data_path = trf_to_data.transform_path_affine(na_path) |
| 2515 | else: |
| 2516 | data_path = trf_to_data.transform_path(path) |
| 2517 | else: |
| 2518 | # For backwards compatibility we update the dataLim with the |
| 2519 | # coordinate range of the given path, even though the coordinate |
| 2520 | # systems are completely different. This may occur in situations |
| 2521 | # such as when ax.transAxes is passed through for absolute |
| 2522 | # positioning. |
| 2523 | data_path = path |
| 2524 | |
| 2525 | if not data_path.vertices.size: |
| 2526 | return |
| 2527 | |
| 2528 | updatex, updatey = line_trf.contains_branch_separately(self.transData) |
| 2529 | if self.name != "rectilinear": |
| 2530 | # This block is mostly intended to handle axvline in polar plots, |
| 2531 | # for which updatey would otherwise be True. |
| 2532 | if updatex and line_trf == self.get_yaxis_transform(): |
| 2533 | updatex = False |
| 2534 | if updatey and line_trf == self.get_xaxis_transform(): |
| 2535 | updatey = False |
| 2536 | self.dataLim.update_from_path(data_path, |
| 2537 | self.ignore_existing_data_limits, |
| 2538 | updatex=updatex, updatey=updatey) |
| 2539 | self.ignore_existing_data_limits = False |
| 2540 | |
| 2541 | def add_patch(self, p): |
| 2542 | """ |
no test coverage detected