# How to use fixed Xlim and YLim commands in processing?

**URL:** <https://discourse.processing.org/t/how-to-use-fixed-xlim-and-ylim-commands-in-processing/14229>\
**Category:** Libraries\
**Created:** [September 27, 2019, 4:26am UTC](https://discourse.processing.org/t/how-to-use-fixed-xlim-and-ylim-commands-in-processing/14229 "2019-09-27T04:26:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![KGS](https://avatars.discourse-cdn.com/v4/letter/k/90ced4/32.png) [@KGS](https://discourse.processing.org/u/KGS)\
**Post date:** [September 27, 2019, 4:26am UTC](https://discourse.processing.org/t/how-to-use-fixed-xlim-and-ylim-commands-in-processing/14229/1 "2019-09-27T04:26:08Z")

</div>

I have created real-time plot with serial communication. I need a fixed vertical axis in my plot. I have used the grafica library to create the graphs. I have seen there is a command in Grafica library as “fixedYLim” and “fixedXLim” to fix the axes in the plot. I could not find a solution in library examples. Can anybody show me how to use fix limits commands??

---

<div class="post-metadata">

**Author:** ![liuzc188](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/liuzc188/32/6596_2.png) [@liuzc188](https://discourse.processing.org/u/liuzc188)\
**Post date:** [September 27, 2019, 5:58am UTC](https://discourse.processing.org/t/how-to-use-fixed-xlim-and-ylim-commands-in-processing/14229/2 "2019-09-27T05:58:26Z")

</div>

> [@KGS](#):
>
> I need a fixed vertical axis in my plot.

no Pictures to show?

---

<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:** [September 27, 2019, 6:08am UTC](https://discourse.processing.org/t/how-to-use-fixed-xlim-and-ylim-commands-in-processing/14229/3 "2019-09-27T06:08:24Z")

</div>

use the library reference  
…/Processing/libraries/grafica/reference/index.html?index-all.html  
( or from PDE / Help / Libraries Reference / grafica / )

and the browser search [ctrl][f] like: XLim  
and find

```auto
void setXLim(float[] newXLim)
Sets the horizontal axes limits
void setXLim(float lowerLim, float upperLim)
Sets the horizontal axes limits
void setFixedXLim(boolean newFixedXLim)
Sets if the horizontal axes limits are fixed or not
float[] getXLim()
Returns the limits of the horizontal axes
boolean getFixedXLim()
Returns true if the horizontal axes limits are fixed

```

* * *

also find in /grafica / examples / Moving Points /

```auto
  // Set the plot limits (this will fix them)
  plot.setXLim(-1.2*scale, 1.2*scale);
  plot.setYLim(-1.2*scale, 1.2*scale);

```
