# Cant set ymin, ymax with gadfly, (plotting simple functions)

Hi,

I’m trying to plot a few simple functions with Gadfly. I’m having trouble setting the ymin and ymax. I’m trying to follow the documentation example:

``````plot(f::Function, lower, upper, elements...; mapping...)
plot(f::Function, xmin, xmax, ymin, ymax, elements...; mapping...)
``````

It plots fine when I’m using this format:

``````plot([A, B, C, D, E], -10, 10)
``````

but that creates really high y values so my functions are squashed and aren’t very readable. I would like to limit the y scale too.

If I use this though:

``````plot([A, B, C, D, E], -10, 10, -10, 10)
``````

I get this error:

``````LoadError: MethodError: no method matching plot(::Array{Function,1}, ::Int64, ::Int64, ::Int64, ::Int64)
Closest candidates are:
plot(!Matched::Function, ::Number, ::Number, ::Number, ::Number, !Matched::Union{Function, Gadfly.Element, Theme, Type}...; mapping...) ```

The whole block of code:

A(x) = (1 - x)
B(x) = (1 / x)
C(x) = ((x -1) / x)
D(x) = (1 / (1 - x))
E(x) = (x / (x - 1))

p = plot([A, B, C, D, E], -10, 10, -10, 10)
draw(SVG("compositions.svg", 6inch, 6inch), p)``````

Welcome to the Julia Community!
As hinted in the p2 example, the syntax

``````plot(f::Function, xmin, xmax, ymin, ymax, elements...; mapping...)
``````

is for functions with 2 variables e.g. `(x,y)->sin(x)+cos(y)`. For one variable functions, use `Coord.cartesian`:

``````plot([A,B,C,D,E], -10, 10, Coord.cartesian(ymin=-10, ymax=10))
``````

Thank you so much! I’m brand new to Julia, and really only have a limited python background. This is actually my first night playing with it, but I’m excited to learn. Thanks again!

spencer