calfem-python icon indicating copy to clipboard operation
calfem-python copied to clipboard

vis_mpl.pltstyle2 doesn't allow nodemark=0 (and supports nodemark=3)

Open oicerid opened this issue 3 weeks ago • 0 comments

When using eldisp2() for instance, the docstring states that plotbar[2] can be 0, 1 or 2.

plotpar : list, optional
        Plot parameters [linetype, linecolor, nodemark]. Default [2, 1, 1].
        
        - linetype: 1=solid, 2=dashed, 3=dotted
        - linecolor: 1=black, 2=blue, 3=magenta, 4=red
        - nodemark: 1=circle, 2=star, 0=no mark

however, plotpar is handled by pltstyle2() and for plotpar[2] it allows values 1, 2 and 3

if p3 == 1:
    node_color = (0, 0, 0)
    node_type = "o"
elif p3 == 2:
    node_color = (0, 0, 0)
    node_type = "*"
elif p3 == 3:
    node_color = (0, 0, 0)
    node_type = "."
else:
    raise ValueError("Invalid value for plotpar[2].")

Suggest to change to:

if p3 == 0:
    node_color = ""
    node_type = ""
elif p3 == 1:
    node_color = (0, 0, 0)
    node_type = "o"
elif p3 == 2:
    node_color = (0, 0, 0)
    node_type = "*"
elif p3 == 3:
    node_color = (0, 0, 0)
    node_type = "."
else:
    raise ValueError("Invalid value for plotpar[2].")

as well as change the docstring so it states that the "3" setting also is availiable for a small dot.

oicerid avatar Dec 05 '25 21:12 oicerid