# Creating a Grafica plot in Pgraphics or new window

**URL:** <https://discourse.processing.org/t/creating-a-grafica-plot-in-pgraphics-or-new-window/17000>\
**Category:** Libraries\
**Created:** [January 10, 2020, 12:41pm UTC](https://discourse.processing.org/t/creating-a-grafica-plot-in-pgraphics-or-new-window/17000 "2020-01-10T12:41:49Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Thomas](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/thomas/32/7236_2.png) [@Thomas](https://discourse.processing.org/u/Thomas)\
**Post date:** [January 10, 2020, 12:41pm UTC](https://discourse.processing.org/t/creating-a-grafica-plot-in-pgraphics-or-new-window/17000/1 "2020-01-10T12:41:49Z")

</div>

Hi all,

I would like to make a Grafica plot in a Pgraphics but soon realised that it is not possible in my case. So I followed the workaround suggested by @GoToLoop on: https://discourse.processing.org/t/plot-grafica-in-pgraphics/2334 and make the plot in a new window.

The example works, but now I try to implement the same functionality in my program and I get the following error:

> window.pde:87:0:87:0: RuntimeException: createGraphics() with P2D requires size() to use P2D or P3D

The error is caused by these lines in the class of GoToLoop:

```auto
void settings() {
    size(450, 450);
  }

```

Removing this block of code or adding P2D to the size does not work.

I know this might be a vague question, but does anyone know how I can solve this problem?

Kind regards,  
Thomas
