0

I am trying to plot a LG beam equation in python where Electric field depends on r (transverse distance from propagation axis), theta (rotation Parameter), and z (propagation distance) and then electric field is calculated

I have made r = np.linspace(0,10,100) theta = np.linspace(0,np.pi,100) z as np.linspace(0,80,100)

then E = function of (r,z,theta)

The issue is I am trying to plot E but not successfull in plotting values of E as scatter or surface but not getting it as expected.

What i want to do is to plot values of E with respect to three axis r , z and theta

Can anyone please guide me how to achieve this using python or any other software

foglerit
  • 7,792
  • 8
  • 44
  • 64
  • It should work something like this where field rotates like in the attached link https://mathematica.stackexchange.com/questions/202641/plot-of-laguerre-gaussian-wavefront – Dinkar Mishra Nov 05 '22 at 08:34
  • 1
    Please provide enough code so others can better understand or reproduce the problem. – Community Nov 05 '22 at 08:45
  • @DinkarMishra are you interested in the 3-D surface plots with spiral folding at the end of you link you mentioned, or in solid volume plots? For complex 3-D surface plots, I think you need something like this: https://matplotlib.org/stable/gallery/mplot3d/trisurf3d_2.html#sphx-glr-gallery-mplot3d-trisurf3d-2-py . If you provide the code with the input arrays, we can help you to get the plot system working. – C-3PO Nov 05 '22 at 08:59
  • Aso by the way, `r = np.linspace(0,10,100); theta = np.linspace(0,np.pi,100); z = np.linspace(0,80,100)` are only 1-D arrays, so the resulting plot will be a flat 3-D line. You need to use `np.meshgrid` or array broadcasting to make grids: https://numpy.org/doc/stable/user/basics.broadcasting.html – C-3PO Nov 05 '22 at 09:02
  • Actually the function is something like E = xyz and all x y and z are variables of different values If i can show x y and z on all three axes then where should i plot E which depends upon all x y and z. this is the main issue. I tried all the above mentioned cases but my aim is to show variation of E with respect to x y and z – Dinkar Mishra Nov 05 '22 at 09:11
  • I am trying this right now but not sure whether it will work like i want or not https://stackoverflow.com/questions/25286811/how-to-plot-a-3d-density-map-in-python-with-matplotlib – Dinkar Mishra Nov 05 '22 at 09:14
  • Thanks for the feedback. I understand you need a 3-D plot, but if you plot a solid you will only see the outer surface, etc. Please post the arrays you want to plot, and a picture of exactly the type of plot you want (3-D surface with spiral folding, volume slices, etc). – C-3PO Nov 05 '22 at 09:29

0 Answers0