How to draw ellipse on top of scatter plot?

One of the solutions I found is to include the rotational angel when we creating the ellipsoids.

When we call the function, and we define the rotational angle as follow:

Example-1:

Notice that we define pi/1.93, which will result in the rotational angel in my model. This will be user define and verified visually by the user.


# well-4

x_center = h4

y_center = k4

angel_4 = pi/1.93

x, y = ellipse(x_center=x_center, y_center=y_center, ax1 =[cos(angel_4), sin(angel_4)], ax2=[-sin(angel_4),cos(angel_4)], a=a4, b =b4)

fig.add_scatter(x=x, y=y, mode = 'lines', name='Zone-1 - well-4', fill='toself', opacity=0.5)

Example-2:

Notice that we define pi/1.935 to rotate the ellipse.


# well-5

x_center = h5

y_center = k5

angel_5 = pi/1.935

x, y = ellipse(x_center=x_center, y_center=y_center, ax1 =[cos(angel_5), sin(angel_5)], ax2=[-sin(angel_5),cos(angel_5)], a=a5-20, b =b5-140)

fig.add_scatter(x=x, y=y, mode = 'lines', name='Zone-1 - well-5', fill='toself', opacity=0.5)

Example-3

Notice that we define pi/1.921 to rotate the ellipse.


# well-6

x_center=h6

y_center=k6

angel_6 = pi/1.921

x, y = ellipse(x_center=x_center, y_center=y_center, ax1 =[cos(angel_6), sin(angel_6)], ax2=[-sin(angel_6),cos(angel_6)], a=a6-25, b =b6-140)

fig.add_scatter(x=x, y=y, mode = 'lines', name='Zone-1 - well-6', fill='toself', opacity=0.8)

Please see the attached figure as an example.