# Plot2d: Create a Simple Overlay Plot

Use the Plot2d Component to create a basic plot to show as an overlay item in the view.

    void TutorialRunnerMainWindow::createPlot()
    {
        //--------------------------------------------------------------------------
        // Create an overlay plot item and add two plot curves
        //--------------------------------------------------------------------------

        // X Values (same for both curves)
        std::vector<double> xValues = { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0 };

        // Y Values
        std::vector<double> y1Values = { 0.0, 1.2, 3.3, 4.0, 3.0, 2.9, 2.8, 2.7, 2.7, 2.7 };
        std::vector<double> y2Values = { 0.0, 1.5, 4.3, 5.0, 4.0, 3.8, 3.5, 3.0, 2.8, 2.7 };

        cee::PtrRef<cee::vis::Font> font = cee::vis::Font::createNormalFont();
        cee::PtrRef<cee::plt::OverlayPlot> plot = new cee::plt::OverlayPlot(font.get());
        plot->setSize(400, 300);
        plot->addCurve("First curve", xValues, y1Values);
        plot->addCurve("Second curve", xValues, y2Values);

        cee::vis::View* gcView = getTutorialView();
        gcView->overlay().addItem(plot.get(), cee::vis::OverlayItem::TOP_RIGHT, cee::vis::OverlayItem::HORIZONTAL);
        gcView->requestRedraw();
    }

Conversation saved
HOOPSY BETA

### Hello! I'm HOOPSY

Your multilingual generative AI assistant for documentation. Ask me anything about HOOPS Envision for Desktop in your own language, or choose a sample question below to start a conversation:

What is HOOPS Envision for Desktop?
What are the latest release notes for HOOPS Envision for Desktop?
How do I start evaluating HOOPS Envision for Desktop?
How do I write my first sample application?
How can I get assistance?

HOOPSY may store conversations according to OpenAI's policy. Responses may not always be accurate.

HOOPSY is thinking...