# Coloring a parametric plot according to the independent variable?

**URL:** <https://community.wolfram.com/t/coloring-a-parametric-plot-according-to-the-independent-variable/7938>\
**Category:** Questions\
**Tags:** graphics-and-visualization\
**Created:** [February 18, 2016, 10:50pm UTC](https://community.wolfram.com/t/coloring-a-parametric-plot-according-to-the-independent-variable/7938 "2016-02-18T22:50:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![georgiosmamakoukas2019](https://avatars.discourse-cdn.com/v4/letter/g/a8b319/32.png) [@georgiosmamakoukas2019](https://community.wolfram.com/u/georgiosmamakoukas2019)\
**Post date:** [February 18, 2016, 10:50pm UTC](https://community.wolfram.com/t/coloring-a-parametric-plot-according-to-the-independent-variable/7938/1 "2016-02-18T22:50:29Z")

</div>

I would like to color my parametric plot according to the independent variable (let’s say time) and show the change in a bar legend. How do I do that?

---

<div class="post-metadata">

**Author:** ![sghuisman](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/sghuisman/32/27850_2.png) [@sghuisman](https://community.wolfram.com/u/sghuisman)\
**Post date:** [February 18, 2016, 11:48pm UTC](https://community.wolfram.com/t/coloring-a-parametric-plot-according-to-the-independent-variable/7938/2 "2016-02-18T23:48:49Z")

</div>

Perhaps you can give an example. To know if your plot is 2D or 3D, and is your parametric plot is over 1 or 2 variables?

---

<div class="post-metadata">

**Author:** ![jasondbiggs](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/jasondbiggs/32/28365_2.png) [@jasondbiggs](https://community.wolfram.com/u/jasondbiggs)\
**Post date:** [February 19, 2016, 8:01am UTC](https://community.wolfram.com/t/coloring-a-parametric-plot-according-to-the-independent-variable/7938/3 "2016-02-19T08:01:36Z")

</div>

As Sander points out, there are many varieties of ParametricPlot, 2D or 3D, one variable or two, but here is just an idea of how you could build a ColorFunction to to suit your needs:

```
{ParametricPlot3D[{Sin[u], Cos[u], u/10}, {u, 0, 20}, 
  ColorFunction -> Function[{x, y, z, u}, Hue[u]]],
 ParametricPlot3D[{4 + (3 + Cos[v]) Sin[u], 4 + (3 + Cos[v]) Cos[u], 
   4 + Sin[v]}, {u, 0, 2 \[Pi]}, {v, -\[Pi], \[Pi]}, 
  ColorFunction -> Function[{x, y, z, u, v}, Hue[u + v]]],
 ParametricPlot[{Sin[u], Sin[2 u]}, {u, 0, 2 Pi}, 
  ColorFunction -> Function[{x, y, u}, Hue[u]]]}

```

 ![Selection_363.png](https://global.discourse-cdn.com/wolfram/original/3X/0/c/0caaa31d9bc0db6935a85218cc9dcb4b2a0aa389.png)
