axtreme.plotting.histogram3d

3D histogram plotting function.

Plotly does not have a plotly.graph_objects.Histogram3d object, this is an attempt to remedy that. The closest is plotly.graph_objects.Histogram2d, but that creates a 2D heatmap.

See Also: - https://github.com/serge-tochilov/barchart3d-plotly - https://github.com/AymericFerreira/Plotly_barchart3D - https://community.plotly.com/t/how-to-do-a-3d-bar-chart-if-possible/32287/5

Functions

histogram3d(samples, *[, n_bins, bounds, ...])

Generate a 3D figure of a 2D histogram of the input samples.

histogram_surface3d(samples, *[, n_bins, ...])

Generate a 3D figure of a 2D histogram of the input samples.

axtreme.plotting.histogram3d.histogram3d(samples: ndarray[tuple[int, int], dtype[float64]], *, n_bins: int = 20, bounds: Sequence[tuple[float, float]] | None = None, density: bool = True, flatshading: bool = True, show: bool = False, mesh3d_kwargs: dict[str, Any] | None = None, layout_kwargs: dict[str, Any] | None = None) Figure

Generate a 3D figure of a 2D histogram of the input samples.

Computes a 2D histogram that is then plotted in 3D as a 3D bar chart (confusing naming…).

Parameters:
  • samples – An array of shape (n_samples, 2) of samples to compute the histogram of.

  • n_bins – The number of bins to use in each dimension.

  • bounds – An array of shape (2, 2) of the bounds of the histogram: ((x_min, x_max), (y_min, y_max)). If None, the bounds are handled by numpy.histogramdd.

  • density – If True, the histogram is normalized to form a probability density function.

  • flatshading – If True, the 3D bars are shaded smoothly.

  • show – If True, the figure is displayed.

  • mesh3d_kwargs – A dictionary of keyword arguments to pass to the plotly Mesh3d object.

  • layout_kwargs – A dictionary of keyword arguments to pass to the update_layout method of the figure.

Returns:

A plotly figure of the 3D histogram. If show is True, the figure is also displayed.

axtreme.plotting.histogram3d.histogram_surface3d(samples: ndarray[tuple[int, int], dtype[float64]], *, n_bins: int = 20, bounds: Sequence[tuple[float, float]] | None = None, density: bool = True, show: bool = False, surface3d_kwargs: dict[str, Any] | None = None, layout_kwargs: dict[str, Any] | None = None) Figure

Generate a 3D figure of a 2D histogram of the input samples.

Computes a 2D histogram that is then plotted in 3D as a surface plot.

Parameters:
  • samples – An array of shape (n_samples, 2) of samples to compute the histogram of.

  • n_bins – The number of bins to use in each dimension.

  • bounds – An array of shape (2, 2) of the bounds of the histogram: ((x_min, x_max), (y_min, y_max)). If None, the bounds are handled by numpy.histogramdd.

  • density – If True, the histogram is normalized to form a probability density function.

  • show – If True, the figure is displayed.

  • surface3d_kwargs – A dictionary of keyword arguments to pass to the plotly Surface3d object.

  • layout_kwargs – A dictionary of keyword arguments to pass to the update_layout method of the figure.

Returns:

A plotly figure of the 3D histogram. If show is True, the figure is also displayed.