@@ -2838,6 +2838,10 @@ def bar3d(self, x, y, z, dx, dy, dz, color=None,
2838
2838
Any additional keyword arguments are passed onto
2839
2839
`~.art3d.Poly3DCollection`.
2840
2840
2841
+ See Also
2842
+ --------
2843
+ mpl_toolkits.mplot3d.axes3d.Axes3D.bar3d_grid
2844
+
2841
2845
Returns
2842
2846
-------
2843
2847
collection : `~.art3d.Poly3DCollection`
@@ -2943,6 +2947,115 @@ def bar3d(self, x, y, z, dx, dy, dz, color=None,
2943
2947
2944
2948
return col
2945
2949
2950
+ @_preprocess_data ()
2951
+ def bar3d_grid (self , x , y , z , dxy = '0.8' , z0 = 0 , ** kwargs ):
2952
+ """
2953
+ Generate a 3D barplot.
2954
+
2955
+ This method creates three-dimensional barplot for bars on a regular
2956
+ xy-grid and on the same level z-plane. Color of the bars can be
2957
+ set uniquely, or cmap can be provided to map the bar heights *z* to
2958
+ colors.
2959
+
2960
+ Parameters
2961
+ ----------
2962
+ x, y : array-like
2963
+ The coordinates of the anchor point of the bars.
2964
+
2965
+ z : array-like
2966
+ The height of the bars.
2967
+
2968
+ dxy : str, tuple[str], optional
2969
+ Width of the bars as a fraction of the data step, by default '0.8'
2970
+
2971
+ z0 : float
2972
+ z-position of the base of the bars. All bars share the same base
2973
+ value.
2974
+
2975
+ data : indexable object, optional
2976
+ DATA_PARAMETER_PLACEHOLDER
2977
+
2978
+ **kwargs
2979
+ Any additional keyword arguments are forwarded to
2980
+ `~.art3d.Poly3DCollection`.
2981
+
2982
+ See Also
2983
+ --------
2984
+ mpl_toolkits.mplot3d.axes3d.Axes3D.bar3d
2985
+
2986
+ Returns
2987
+ -------
2988
+ bars : `~.art3d.Bar3DCollection`
2989
+ A collection of three-dimensional polygons representing the bars
2990
+ (rectangular prisms).
2991
+ """
2992
+
2993
+ bars = art3d .Bar3DCollection (x , y , z , dxy , z0 , ** kwargs )
2994
+ self .add_collection (bars )
2995
+
2996
+ # compute axes limits
2997
+ viewlim = np .array ([(np .min (x ), np .max (x ) + bars .dx ),
2998
+ (np .min (y ), np .max (y ) + bars .dy ),
2999
+ (min (bars .z0 , np .min (z )), np .max (z ))])
3000
+
3001
+ self .auto_scale_xyz (* viewlim , False )
3002
+
3003
+ return bars
3004
+
3005
+ @_preprocess_data ()
3006
+ def hexbar3d (self , x , y , z , dxy = '0.8' , z0 = 0 , ** kwargs ):
3007
+ """
3008
+ This method creates three-dimensional barplot with hexagonal bars for a
3009
+ regular xy-grid on the same level z-plane. Color of the bars can be set
3010
+ uniquely, or cmap can be provided to map the bar heights *z* to colors.
3011
+
3012
+ Parameters
3013
+ ----------
3014
+ x, y: array-like
3015
+ The coordinates of the anchor point of the bars.
3016
+
3017
+ z: array-like
3018
+ The height of the bars.
3019
+
3020
+ dxy : str, optional
3021
+ _description_, by default '0.8'
3022
+
3023
+ z0 : float
3024
+ z-position of the base of the bars. All bars share the same base
3025
+ value.
3026
+
3027
+ data : indexable object, optional
3028
+ DATA_PARAMETER_PLACEHOLDER
3029
+
3030
+ **kwargs
3031
+ Any additional keyword arguments are forwarded to
3032
+ `~.art3d.Poly3DCollection`.
3033
+
3034
+ See Also
3035
+ --------
3036
+ mpl_toolkits.mplot3d.axes3d.Axes3D.bar3d
3037
+
3038
+ Returns
3039
+ -------
3040
+ bars : `~.art3d.HexBar3DCollection`
3041
+ A collection of three-dimensional polygons representing the bars
3042
+ (hexagonal prisms).
3043
+ """
3044
+
3045
+ bars = art3d .HexBar3DCollection (x , y , z , dxy , z0 , ** kwargs )
3046
+ self .add_collection (bars )
3047
+
3048
+ # compute axes limits
3049
+ dx = bars .dx / 2
3050
+ dy = bars .dy / 2 #/ np.sqrt(3)
3051
+ viewlim = np .array ([(np .min (x ) - dx , np .max (x ) + dx ),
3052
+ (np .min (y ) - dy , np .max (y ) + dy ),
3053
+ (min (bars .z0 , np .min (z )), np .max (z ))])
3054
+
3055
+ self .auto_scale_xyz (* viewlim , False )
3056
+
3057
+ return bars
3058
+
2946
3059
def set_title (self , label , fontdict = None , loc = 'center' , ** kwargs ):
2947
3060
# docstring inherited
2948
3061
ret = super ().set_title (label , fontdict = fontdict , loc = loc , ** kwargs )
0 commit comments