# Plotting functions directly in Makie

**URL:** https://discourse.julialang.org/t/plotting-functions-directly-in-makie/53612
**Category:** Tooling
**Tags:** makie
**Created:** [January 19, 2021, 2:56pm UTC](https://discourse.julialang.org/t/plotting-functions-directly-in-makie/53612 "2021-01-19T14:56:09Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![TheLateKronos](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/thelatekronos/32/12824_2.png) [@TheLateKronos](https://discourse.julialang.org/u/TheLateKronos)
#### Post date: [January 19, 2021, 2:56pm UTC](https://discourse.julialang.org/t/plotting-functions-directly-in-makie/53612/1 "2021-01-19T14:56:09Z")

</div>

A syntax from Plots.jl that I love is `plot(x->x^2)`, and `plot(cos)`, where I can add a second and third argument to specify a range of x-values. This is really an example of delicious syntax - straight to the point.

I say, if the function can be smart enough to create arrays of corresponding points using the function passed, then let it do it, so that I don’t have to define variables to hold the values when I only want to use it for plotting.

Is this possible in Makie? I have tried a couple of things are had a small look around in the example gallery, but I have not seen any indication that this is implemented. If it is correct that it is not, are there plans to make it happen?

---

<div class="post-metadata">

### Author: ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://discourse.julialang.org/u/jules)
#### Post date: [January 19, 2021, 9:40pm UTC](https://discourse.julialang.org/t/plotting-functions-directly-in-makie/53612/2 "2021-01-19T21:40:11Z")

</div>

`lines(0..10, sin)` works for example, there are a couple others, but not a single function without an interval as far as I know

---

<div class="post-metadata">

### Author: ![TheLateKronos](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/thelatekronos/32/12824_2.png) [@TheLateKronos](https://discourse.julialang.org/u/TheLateKronos)
#### Post date: [January 22, 2021, 8:36am UTC](https://discourse.julialang.org/t/plotting-functions-directly-in-makie/53612/3 "2021-01-22T08:36:33Z")

</div>

For completeness, both of the examples below work. In order to understand it, I view it as still giving xvalues and then yvalues as intervals, ranges, and functions instead of datapoints:

```julia
using GLMakie
plot(0..2, x->x^2)
plot(0:0.1:2, x->x^3)

```
