Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Dashed line in a one variable parametric_plot3d

Say you have a 3d line parametric plot (or parametric_plot3d with one variable). How can you stile the resulting plotted line in a dashed style?

Checked out the documentation and I noticed parametric_plot3d has an option for border_style. However it looks like this has no affect when the area is zero.

There appears to be linestyle available to 2d plots but this has no effect in 3d plots whether specified directly or in border_style.

I also tried giving the colour a colourmap via colormaps.autumn but I get an error:

TypeError: unable to simplify to float approximation

Example

Below is the specific example I'm trying to dash. It is the second parametric_plot3d with the comments:

var(['x', 'y', 'z', 'u', 'v', 'r', 'theta'])

angle = 30 * pi / 180

radius = tan(angle)*z

show(
    parametric_plot3d(
        (
            r*cos(theta),
            r*sin(theta),
            r/tan(30 * pi / 180)
        ),
        (r, 0, radius(z = 1)),
        (theta, 0, 2*pi),
        opacity = 0.5
    )
    + point3d((radius(z = 0.5), 0, 0.5), color = 'red')
    + parametric_plot3d(
        (
            radius(z = 0.5)*cos(theta),
            radius(z = 0.5)*sin(theta),
            0.5
        ),
        (theta, 0, 2*pi),
        # color = 'red', # Produces a solid red line
        # color = (theta, colormaps.autumn) # Throws an error
        # linestyle = '--', # Does not work
        # boundary_style = {  # Does not work
        #   'thickness': 5,
        #   'linestyle': '--',
        #   'color': 'red'
        # }
    )
)