# Grafica Library, changing colour of specific points

**URL:** <https://discourse.processing.org/t/grafica-library-changing-colour-of-specific-points/7151>\
**Category:** Libraries\
**Created:** [January 4, 2019, 9:32am UTC](https://discourse.processing.org/t/grafica-library-changing-colour-of-specific-points/7151 "2019-01-04T09:32:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![simmi](https://avatars.discourse-cdn.com/v4/letter/s/ac8455/32.png) [@simmi](https://discourse.processing.org/u/simmi)\
**Post date:** [January 4, 2019, 9:32am UTC](https://discourse.processing.org/t/grafica-library-changing-colour-of-specific-points/7151/1 "2019-01-04T09:32:30Z")

</div>

I want to plot the graph of reading of gyroscope data vs Time. I am using grafica library. I am adding the point in the points in the loop and want to change the color of specific points when certain condition is detected while plotting the graph. the code my plot\_graph() is called from the draw function. But it changes the color of complete graph.  
Please help. Please suggest  
gy: has array of gyroscope data and time has timestamp

```auto
void draw(){
while (iteration<max_count)
{
plot_graph();
iteration++;
}
}
plot_graph()
{

    points2.add(time[iteration],gy[iteration]);
    plot1.setPoints(points2);  
    plot1.beginDraw();
    plot1.drawBackground();
    plot1.drawXAxis();
    plot1.drawYAxis();
    plot1.drawTopAxis();
    plot1.drawRightAxis();
    plot1.drawTitle();
    plot1.drawGridLines(GPlot.BOTH);
    if (status==a)
    {
    plot1.setPointColor(color(0, 200, 0));
    }
    else if (status==b)
    {
    plot1.setPointColor(color(200,0, 42));
    }
    plot1.getMainLayer().drawPoints();
    plot1.activatePointLabels();
    plot1.activatePanning();
    plot1.activateZooming(1.1, CENTER, CENTER);   
    plot1.activateZooming(1.5);
    plot1.endDraw();
}

```

---

<div class="post-metadata">

**Author:** ![kll](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kll/32/964_2.png) [@kll](https://discourse.processing.org/u/kll)\
**Post date:** [January 24, 2019, 4:03am UTC](https://discourse.processing.org/t/grafica-library-changing-colour-of-specific-points/7151/2 "2019-01-24T04:03:04Z")

</div>

> [@simmi](#):
>
> But it changes the color of complete graph.

yes, i think that lib not has that multi color feature???

> can you show a picture how it looks now

> and a description on the criteria of color change

to give a idea if a other way would be more easy

see here i make my own graph,  
with a few code lines, possibly less i would need using any lib.

> [@Library to apply BandPass filter for EEG signals in Processing](https://discourse.processing.org/t/library-to-apply-bandpass-filter-for-eeg-signals-in-processing/4972/8):
>
> actually a low pass filter might do it, but filter 50 but get 30 [Hz] is not so easy ( you have to live with loss in amplitude and phase shift ( late ) ) but you not answer much questions, so still not know if you have batch data to analyze, or stream? you also possibly can not afford to use cpu demanding calculations. so why not just try the most easy filter ever! fil = inval \* A + fil \* B; ok, there are some small things about that: -a- tuning: A + B = 1; -b- init: a startup is dif…

---

<div class="post-metadata">

**Author:** ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)\
**Post date:** [January 24, 2019, 4:45pm UTC](https://discourse.processing.org/t/grafica-library-changing-colour-of-specific-points/7151/3 "2019-01-24T16:45:42Z")

</div>

> [@simmi](#):
>
> I am adding the point in the points in the loop and want to change the color of specific points when certain condition is detected while plotting the graph.

Here is a previous post from the developer on the old forum discussing how to set individual point colors in grafica. Two different approaches are discussed in detail with example code.

> **[Processing 2.x and 3.x Forum](https://forum.processing.org/two/discussion/comment/64308/#Comment_64308)**
>
> Processing is an electronic sketchbook, a language and a worldwide community. This is its forum.
