Create a 3D contour plot. .. note:: This method currently produces incorrect output due to a longstanding bug in 3D PolyCollection rendering. Parameters ---------- X, Y, Z : array-like Input data. See `.Axes.tricontour` f
(self, *args,
extend3d=False, stride=5, zdir='z', offset=None, axlim_clip=False,
**kwargs)
| 2912 | |
| 2913 | @_preprocess_data() |
| 2914 | def tricontour(self, *args, |
| 2915 | extend3d=False, stride=5, zdir='z', offset=None, axlim_clip=False, |
| 2916 | **kwargs): |
| 2917 | """ |
| 2918 | Create a 3D contour plot. |
| 2919 | |
| 2920 | .. note:: |
| 2921 | This method currently produces incorrect output due to a |
| 2922 | longstanding bug in 3D PolyCollection rendering. |
| 2923 | |
| 2924 | Parameters |
| 2925 | ---------- |
| 2926 | X, Y, Z : array-like |
| 2927 | Input data. See `.Axes.tricontour` for supported data shapes. |
| 2928 | extend3d : bool, default: False |
| 2929 | Whether to extend contour in 3D. |
| 2930 | stride : int, default: 5 |
| 2931 | Step size for extending contour. |
| 2932 | zdir : {'x', 'y', 'z'}, default: 'z' |
| 2933 | The direction to use. |
| 2934 | offset : float, optional |
| 2935 | If specified, plot a projection of the contour lines at this |
| 2936 | position in a plane normal to *zdir*. |
| 2937 | axlim_clip : bool, default: False |
| 2938 | Whether to hide lines with a vertex outside the axes view limits. |
| 2939 | |
| 2940 | .. versionadded:: 3.10 |
| 2941 | data : indexable object, optional |
| 2942 | DATA_PARAMETER_PLACEHOLDER |
| 2943 | *args, **kwargs |
| 2944 | Other arguments are forwarded to `matplotlib.axes.Axes.tricontour`. |
| 2945 | |
| 2946 | Returns |
| 2947 | ------- |
| 2948 | matplotlib.tri._tricontour.TriContourSet |
| 2949 | """ |
| 2950 | had_data = self.has_data() |
| 2951 | |
| 2952 | tri, args, kwargs = Triangulation.get_from_args_and_kwargs( |
| 2953 | *args, **kwargs) |
| 2954 | X = tri.x |
| 2955 | Y = tri.y |
| 2956 | if 'Z' in kwargs: |
| 2957 | Z = kwargs.pop('Z') |
| 2958 | else: |
| 2959 | # We do this so Z doesn't get passed as an arg to Axes.tricontour |
| 2960 | Z, *args = args |
| 2961 | |
| 2962 | jX, jY, jZ = art3d.rotate_axes(X, Y, Z, zdir) |
| 2963 | tri = Triangulation(jX, jY, tri.triangles, tri.mask) |
| 2964 | |
| 2965 | cset = super().tricontour(tri, jZ, *args, **kwargs) |
| 2966 | self.add_contour_set(cset, extend3d, stride, zdir, offset, axlim_clip) |
| 2967 | |
| 2968 | self.auto_scale_xyz(X, Y, Z, had_data) |
| 2969 | return cset |
| 2970 | |
| 2971 | def _auto_scale_contourf(self, X, Y, Z, zdir, levels, had_data): |