Possible Bug: omni.ui.plot does not plot ints

The underlying data container for plots is type float but passing in an integer array should auto convert to floats so they can still be plotted. Currently if a integer exists in a plot’s data it just skips it.

self.window_test = omni.ui.Window("Test", width=200,height=200)
with self.window_test.frame:
    data1 = [1,3,9]
    data2 = [1.0,3.0,9.0]
    omni.ui.Plot(
        omni.ui.Type.LINE,
        0,
        10,
        *data1,
        style={"color": cl.red}
    )

self.window_test = omni.ui.Window("Test", width=200,height=200)
with self.window_test.frame:
    data1 = [1,3,9]
    data2 = [1.0,3.0,9.0]
    omni.ui.Plot(
        omni.ui.Type.LINE,
        0,
        10,
        *data2,
        style={"color": cl.red}
    )

Solution for those who want to avoid this issue in their own projects for now or if this gets marked as the intended behavior:

self.window_test = omni.ui.Window("Test", width=200,height=200)
with self.window_test.frame:
    data1 = [1,3,9]
    data2 = [1.0,3.0,9.0]
    omni.ui.Plot(
        omni.ui.Type.LINE,
        0,
        10,
        *np.array(data1, dtype=float),
        style={"color": cl.red}
    )
1 Like

Thanks for letting us know. I will look into it.