I am trying to figure out how to rotate a function in spherical coordinates. In my specific example, I have a 3D graph $D(\theta,\phi)=\frac{3}{2}sin^2(\theta)$ (it's the directivity in the far-field of a $\hat z$ oriented Hertzian dipole antenna).
However, I would now like to know what the graph would look like in my original reference frame if I rotated the graph for instance 90° about the y-axis (in particular, I want to know what the directivity of a $\hat x$ oriented Hertzian dipole would be like in spherical coordinates).
In other words... If I know how the function $D(\theta,\phi)$ looks in spherical coordinates in my standard reference frame (X,Y,Z), how can I describe a rotated version of it in the same reference frame?
I think that probably the answer lies in just applying a 3D rotation matrix, but I am confused to how this can be done for a function that is not in cartesian coordinates...
Thank you very much for your time an patience, have a nice day!