omni.ui.Plot does not seem to render correctly within a USD Explorer kit custom extension

It appears only a dark gray box is rendered within a widget instead of plot lines. I confirmed the plot is active as the mouse event callbacks trigger. Should this code display a correct plot?

I have attached the following code and screenshot below.

def test(self, one=None, two=None, three=None, four=None):
    print("Released",one,two,three,four)
print("Show Plot!", omni.client.get_version())
self._window = omni.ui.Window("Data Acquisition", width=650, height=450)
with self._window.frame:
    self.plot = omni.ui.Plot(omni.ui.Type.LINE, valueList=[(1,1),(2,2),(3,4)], mouse_released_fn = test)
    self.plot.visible = True
    self.plot.enabled = True
    self.plot.title = "Test"

image

Can we get some more information on this? There is not a lot here to work with. Can we have your whole script and exactly what you are trying to do. You are trying to draw a line in the “UI” ?

I created a basic Omniverse extension (for the purpose of this post). The Extension.py code is below. When the extension is loaded a widget pops up (as expected) and loads the plot (dark gray) as click events do work when the window is clicked. No lines are plotted though.

The only other information I could find on “omni.ui.Plot” other than the main Omniverse auto generated API docs was this post: What is the input data type required by omni.ui.Plot?

This post shows plots that looks like this and is what I expect Omniverse plots to look like:

Extension.py

import omni

class PlotWidget(omni.ext.IExt):
    def on_startup(self, ext_id):
        def test(self, one=None, two=None, three=None, four=None):
            print("Released",one,two,three,four)
        print("Show Plot!", omni.client.get_version())
        self._window = omni.ui.Window("Data Acquisition", width=650, height=450)
        with self._window.frame:
            self.plot = omni.ui.Plot(omni.ui.Type.LINE, valueList=[(1,1),(2,2),(3,4)], mouse_released_fn = test)
            self.plot.visible = True
            self.plot.enabled = True
            self.plot.title = "Test"

init.py

from .extension import *

Let me see if I can find someone to help you.

Thanks for your help.

My problem actually got solved by the Omniverse Kit folks. Posting answer here as well to wrap up discussion.

  • omni.ui.Type.LINE is a 3d line within a plot and omni.ui.Type.LINE2D is the actual normal 2d line plot.
  • You must specify a style color or plot will appear as it was not drawn
  • Set data using set_xy_data and ignore valueList
def test(self, one=None, two=None, three=None, four=None):
            print("Released",one,two,three,four)
        print("Show Plot!", omni.client.get_version())
        self._window = omni.ui.Window("Data Acquisition", width=650, height=450)
        with self._window.frame:
            self.plot = omni.ui.Plot(omni.ui.Type.LINE2D,
                                    mouse_released_fn = test,
                                    style={"color": omni.ui.color.white})
            self.plot.set_xy_data([(1,1),(2,2),(3,4)])
            self.plot.title = "Test"

Original answer: [QUESTION]: omni.ui.Plot does not seem to render correctly? · Issue #46 · NVIDIA-Omniverse/kit-app-template · GitHub

Great, that is wonderful to hear !

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.