# Problem to plot vector fields (Stokes problem)

**URL:** <https://community.freefem.org/t/problem-to-plot-vector-fields-stokes-problem/1496>\
**Category:** General Discussion\
**Created:** [February 15, 2022, 10:10am UTC](https://community.freefem.org/t/problem-to-plot-vector-fields-stokes-problem/1496 "2022-02-15T10:10:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Loic](https://avatars.discourse-cdn.com/v4/letter/l/e9c0ed/32.png) [@Loic](https://community.freefem.org/u/Loic)\
**Post date:** [February 15, 2022, 10:10am UTC](https://community.freefem.org/t/problem-to-plot-vector-fields-stokes-problem/1496/1 "2022-02-15T10:10:04Z")

</div>

Hello all,

I am solving the Stokes Problem,

```auto

// Fespace
fespace Uh(ThRef, P1b);
Uh u, v;
Uh uu, vv;

fespace Ph(ThRef, P1);
Ph p, pp;

// Problem
solve stokes ([u, v, p], [uu, vv, pp])
     = int2d(ThRef)(
          dx(u)*dx(uu)
         + dy(u)*dy(uu)
         + dx(v)*dx(vv)
         + dy(v)*dy(vv)
         + dx(p)*uu
         + dy(p)*vv
         + pp*(dx(u) + dy(v))
         - 1e-10*p*pp
     )
     + on(lab0, u=0, v=0)
     + on(20, u=1, v=0)
     ;

// Plot
plot([u,v],p, wait=1);

```

However when I want to plot the vector field I have this following error:

```auto
 Error line number 48, in file ReferenceStokes.edp, before token )
plot of array with wrong number of components (!= 2 or 3) 
  current line = 48
Compile error : plot of array with wrong number of components (!= 2 or 3) 
	line number :48, )
error Compile error : plot of array with wrong number of components (!= 2 or 3) 
	line number :48, )
 code = 1 mpirank: 0

```

The plot works well when I plot component by component.

Could someone know how to solve this problem ?

Thank you in advance,

Best regards,

Loïc,

---

<div class="post-metadata">

**Author:** ![zhk](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/zhk/32/874_2.png) [@zhk](https://community.freefem.org/u/zhk)\
**Post date:** [January 16, 2023, 7:38am UTC](https://community.freefem.org/t/problem-to-plot-vector-fields-stokes-problem/1496/2 "2023-01-16T07:38:28Z")

</div>

You can clearly see the red coloured text indicates that this part is not defined. You can copy the complete code from here  
[https://doc.freefem.org/tutorials/stokes.html](https://doc.freefem.org/tutorials/stokes.html)
