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