# GKS error in plotting using Plots packages

**URL:** <https://discourse.julialang.org/t/gks-error-in-plotting-using-plots-packages/89526>\
**Category:** New to Julia\
**Tags:** question, package, plotting\
**Created:** [October 30, 2022, 3:16pm UTC](https://discourse.julialang.org/t/gks-error-in-plotting-using-plots-packages/89526 "2022-10-30T15:16:04Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tsegev123](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tsegev123/32/30789_2.png) [@Tsegev123](https://discourse.julialang.org/u/Tsegev123)\
**Post date:** [October 30, 2022, 3:16pm UTC](https://discourse.julialang.org/t/gks-error-in-plotting-using-plots-packages/89526/1 "2022-10-30T15:16:04Z")

</div>

Hey all,  
I am trying to plot a graph on Julia, and the plot is being done but I don’t see the axes, nor the title or legend, all I get is the following message:

GKS: Rectangle definition is invalid in routine SET\_VIEWPORT

and the plot itself looks like this:  
 ![vka](https://global.discourse-cdn.com/julialang/original/3X/8/c/8cccdc1e6492fc55c433e9b6f8e2d3b86d256296.png)

The plotting is of some complex function which I took only the real part.  
Does anyone knows and can help ?  
thanks for all the helpers!

---

<div class="post-metadata">

**Author:** ![BeastyBlacksmith](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/beastyblacksmith/32/4741_2.png) [@BeastyBlacksmith](https://discourse.julialang.org/u/BeastyBlacksmith)\
**Post date:** [October 30, 2022, 8:07pm UTC](https://discourse.julialang.org/t/gks-error-in-plotting-using-plots-packages/89526/2 "2022-10-30T20:07:14Z")

</div>

That looks like a lot of points. I would try to take a smaller sample (lets say every 100th point)

---

<div class="post-metadata">

**Author:** ![Tsegev123](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tsegev123/32/30789_2.png) [@Tsegev123](https://discourse.julialang.org/u/Tsegev123)\
**Post date:** [October 31, 2022, 6:49am UTC](https://discourse.julialang.org/t/gks-error-in-plotting-using-plots-packages/89526/3 "2022-10-31T06:49:42Z")

</div>

The issue with the points is not the problem, I already tried to take a fewer points.

---

<div class="post-metadata">

**Author:** ![t-bltg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/t-bltg/32/25526_2.png) [@t-bltg](https://discourse.julialang.org/u/t-bltg)\
**Post date:** [October 31, 2022, 7:33am UTC](https://discourse.julialang.org/t/gks-error-in-plotting-using-plots-packages/89526/4 "2022-10-31T07:33:44Z")

</div>

`GKS: Rectangle definition is invalid in routine SET_VIEWPORT`

That usually happens when handling huge values (close to `Inf`), or trying to plot invalid values (negative or zeros in logarithmic scales, …).

If you need help, you need to provide more information on the data plotted, or even better provide a `MWE`.

---

<div class="post-metadata">

**Author:** ![Tsegev123](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tsegev123/32/30789_2.png) [@Tsegev123](https://discourse.julialang.org/u/Tsegev123)\
**Post date:** [October 31, 2022, 7:42am UTC](https://discourse.julialang.org/t/gks-error-in-plotting-using-plots-packages/89526/5 "2022-10-31T07:42:32Z")

</div>

The arguments are valid, I already checked them based on the same error other people got.  
I think I solved that by moving to the Plotly backend

---

<div class="post-metadata">

**Author:** ![t-bltg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/t-bltg/32/25526_2.png) [@t-bltg](https://discourse.julialang.org/u/t-bltg)\
**Post date:** [October 31, 2022, 7:45am UTC](https://discourse.julialang.org/t/gks-error-in-plotting-using-plots-packages/89526/6 "2022-10-31T07:45:25Z")

</div>

That’s not what I’d call `solving` a problem (bug fixes could benefit to other users).  
But good anyway that another backend suits your needs.
