How to use contours labelformat?

Hi,

I am trying to adjust labels for level contours. Example is given below. However, while it doesnโ€™t cause any errors, there is no visible change in the labels.

    fig = go.Figure()

        fig.add_contour(
            x=x, y=y, z=z,
            contours_coloring='none',
            line=dict(color='black'),
            contours=dict(
                showlabels=True,
                labelformat=".2f V",
                type='constraint',
                value = levels,
            )
        )

    fig.update_layout(
        {"showlegend": True}
    )

I have found the following in the docs labelformat, that it should be possible from plotly 6.0.0 and I have version 6.0.1 installed. Also I do not fully understand what d3-format means, but I see that labelformat accepts a string. I suppose that is the reason why there is no error reported.

Perhaps I am just missing some activation/apply button?

Hey @haca welcome to the forums.

It seems youโ€™re trying to add a trailing char (โ€œVโ€) to the number itself which leads to the format-string not being recognized.

1 Like