I want to understand the distribution of orientation angles in a 3D image (represented as a triangular mesh).

For each triangle in the image I have zenith ($\Theta$) and azimuth ($\phi$)

enter image description here

And I can compute histograms for each:

enter image description here

Is there a way that I can combine the information contained in these images into a single histogram representing the joint distribution of these variables?

  • $\begingroup$ Can you give more details on the actual problem? What prevents you from doing the same you did in 1D also in 2D? $\endgroup$
    – davidhigh
    Jul 7, 2014 at 20:28
  • $\begingroup$ I'd like to wrap these circular distributions, e.g. so that the values of $\phi$ meet at $\pm \pi$ $\endgroup$ Jul 7, 2014 at 20:38
  • $\begingroup$ the actual problem is related to 3D realizations of a plant canopy, as described in Song et al 2013 to summarize the distribution of leaf elements in a plant canopy. $\endgroup$ Jul 7, 2014 at 20:53
  • $\begingroup$ It seems no real problem if this wrapping is your only point. Just choose an histogram-grid $z_j$ such that the boundaries are either connected (e.g. regions $[-1,-0.9], ... , [0.9,1]$) or wrap into the other end (e.g. $ [-0.95,-0.85] ... , [0.95,-0.95]$). $\endgroup$
    – davidhigh
    Jul 8, 2014 at 8:05

2 Answers 2


The way to determine a two-dimensional histogram is very similar to the one-dimensional case.

Basically in 1D, you sum up all knots within a certain interval or bin. That is for $\varphi$, you count all points in the "beam" $\varphi \in [\varphi_i-\Delta \varphi_i, \varphi + \Delta \varphi]$, $\theta \in [-1,1]$, and divide by the total number of points. This procedure can be seen to give a Monte-Carlo estimate of the integral

$$P_i =\int_{\varphi_i-\Delta \varphi}^{\varphi_i-\Delta \varphi} d\varphi \int_{0}^\pi d\theta \, \sin(\theta) \ p(r,\varphi, \theta)\\ =\int_{\varphi_i-\Delta \varphi}^{\varphi_i-\Delta \varphi} d\varphi \int_{-1}^1 dz \ \tilde p(r,\varphi, z)=\frac{N_i}{N} $$

where $p(r,\varphi, \theta)$ is the density which generates the points (which admittedly will hardly become continuous for your picture), and $\tilde p(r,\varphi, z)$ is the transformed density for $z=\cos \theta$.

In result, you get for each azimuthal grid point $\varphi_i$ a real number $P_i$ (alternatively, you can also plot unnormalized values $N_i$). The same goes for $z_j$ (caution: due to the volume element of the sphere, if you look for equally space bins, you have to work in the transformed coordinate $z$, otherwise you won't get consistent bin-volumes).

Similarly, in the two-dimensional case, you span a two-dimensional grid of regions $\varphi \in [\varphi_i-\Delta \varphi_i, \varphi + \Delta \varphi]$, $z \in [z_j - \Delta z,z_j + \Delta z]$, count the number of knots and obtain the coresponding approximate probabilities $P_{ij}$. Finally, you simply plot the data in a 3D picture with the data given in the form

$$\varphi_i, \ z_j, \ P_{ij}$$

Such three-dimensional plots are supported by almost any plot program.

  • $\begingroup$ Despite the unfortunate wording at the end, this question makes it clear that the data consist of $(\theta,\phi)$ pairs describing points on a sphere. The approaches you suggest will not work correctly because they are designed for Euclidean density estimates. Moreover, the area elements in your integrals, $d\phi d\theta$, are not the correct ones for the sphere. $\endgroup$
    – whuber
    Jul 7, 2014 at 19:43
  • 1
    $\begingroup$ Thanks for your point, I made a rough correction. I'll further ask the OP for more details. $\endgroup$
    – davidhigh
    Jul 7, 2014 at 20:25

Given that you're ignoring r for each triangle, your coordinates describe points on a sphere and your problem corresponds to visualization of data across longitude/latitude values. The good news is that that's a well-studied problem with lots of tools available. The bad news is no really good solutions have been found for representing a globe in 2D. Nonetheless, it's such a common problem that we've come to accept the limitations of a few common projections. A 2D heatmap with a map projection may be useful.

  • $\begingroup$ you can take a look of the software visumap that enables you to embed high dimensional data into 2d or 3d manifolds (like sphere, projective plane, S3, etc.) and provides interface for interactive exploration. $\endgroup$
    – James LI
    Jul 8, 2014 at 5:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.