# Making Sure the Graphs I Plot is Correct

**URL:** <https://discourse.julialang.org/t/making-sure-the-graphs-i-plot-is-correct/84626>\
**Category:** General Usage\
**Tags:** pyplot, plots, gr\
**Created:** [July 22, 2022, 6:44am UTC](https://discourse.julialang.org/t/making-sure-the-graphs-i-plot-is-correct/84626 "2022-07-22T06:44:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Freya\_the\_Goddess](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/freya_the_goddess/32/36835_2.png) [@Freya\_the\_Goddess](https://discourse.julialang.org/u/Freya_the_Goddess)\
**Post date:** [July 22, 2022, 6:44am UTC](https://discourse.julialang.org/t/making-sure-the-graphs-i-plot-is-correct/84626/1 "2022-07-22T06:44:20Z")

</div>

Hi all,

I just want to make sure that the graphs plot I made are correct. It is a limit problems in Calculus. I am just doubting if the graphs of mine are correct.

I want t know whether we can automatically plot the:

1. Saddle point
2. all local and global maximum or minimum point when the first derivative is zero
3. The measurement of x axis and y axis, instead of `0,1,2,...` can we make it into smaller increments like, `0,0.02,0.04,...`?

Can the package of GR or Pyplot or anything plot it automatically? like `scatter!` function

```julia

using Plots, LaTeXStrings
pyplot() 
#gr()

f(x) = abs(x-1)/(x-1)
g(x) = abs(x-1)/(x-1)
h(x) = (x^2 - abs(x-1) - 1)/abs(x-1)
i(x) = (1/(x-1))-(1/abs(x-1))

p1 = plot(f, -8, 8)
p2 = plot(g, -8, 8)
p3 = plot(h, -8, 8)
p4 = plot(i, -8, 8)

l1 = L"\lim_{x \rightarrow 1} \frac{|x-1|}{x-1}"
l2 = L"\lim_{x \rightarrow 1^-} \frac{|x-1|}{x-1}"
l3 = L"\lim_{x \rightarrow 1^-} \frac{x^2 - |x-1| - 1}{|x-1|}"
l4 = L"\lim_{x \rightarrow 1^-} \frac{1}{x-1}-\frac{1}{|x-1|}"

plot(p1, p2, p3, p4, layout = (2, 2), xaxis = "x", yaxis = "y", label="", legend=:outertop,
title=[l1 l2 l3 l4],
titleloc = :bottom, titlefont = font(8))

```

 ![ch1-calculus-2limits-11](https://global.discourse-cdn.com/julialang/original/3X/9/7/973b6387a27ac7c9bb656852809921fbc612f001.png)

---

<div class="post-metadata">

**Author:** ![nilshg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nilshg/32/2283_2.png) [@nilshg](https://discourse.julialang.org/u/nilshg)\
**Post date:** [July 22, 2022, 9:08am UTC](https://discourse.julialang.org/t/making-sure-the-graphs-i-plot-is-correct/84626/2 "2022-07-22T09:08:09Z")

</div>

On (3) you can just do `xticks = -9:0.2:9`.

(1) and (2) aren’t really questions for a plotting package, but for packages which implement methods to find saddle points or extrema - just have a google around or search this forum to find discussions like

> [@Finding saddle point](https://discourse.julialang.org/t/finding-saddle-point/21168/7):
>
> @cortner note that this problem has an explicit saddle separation: min\_x max\_y f(x,y). That simplifies things a lot, and might actually be a good basis to think about robust algorithms @amrods essentially yes. But you don’t know how to compute derivatives of F(x) = |nabla f(x)| so you don’t want to do a Newton-like iteration. Also Newton doesn’t see minima, saddles or maxima, it just sees critical points (and so if you start near a minimum it will converge to that). OTOH flipped gradient iterat…

---

<div class="post-metadata">

**Author:** ![Freya\_the\_Goddess](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/freya_the_goddess/32/36835_2.png) [@Freya\_the\_Goddess](https://discourse.julialang.org/u/Freya_the_Goddess)\
**Post date:** [July 22, 2022, 9:37am UTC](https://discourse.julialang.org/t/making-sure-the-graphs-i-plot-is-correct/84626/3 "2022-07-22T09:37:56Z")

</div>

thanks for the answer, it helps a lot
