# Plots not working with MethodError or Undefined

**URL:** <https://discourse.julialang.org/t/plots-not-working-with-methoderror-or-undefined/68495>\
**Category:** New to Julia\
**Tags:** statsplots\
**Created:** [September 20, 2021, 8:41pm UTC](https://discourse.julialang.org/t/plots-not-working-with-methoderror-or-undefined/68495 "2021-09-20T20:41:15Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hamzah\_Iqbal](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/hamzah_iqbal/32/29355_2.png) [@Hamzah\_Iqbal](https://discourse.julialang.org/u/Hamzah_Iqbal)\
**Post date:** [September 20, 2021, 8:41pm UTC](https://discourse.julialang.org/t/plots-not-working-with-methoderror-or-undefined/68495/1 "2021-09-20T20:41:15Z")

</div>

I am trying to plot columns of a dataframe and tried to run the example [here](https://docs.juliaplots.org/latest/input_data/#DataFrames-support).

```julia
using StatsPlots, RDatasets
gr()
iris = DataFrame(dataset("iris"))
@df iris scatter(
    :SepalLength,
    :SepalWidth,
    group = :Species,
    m = (0.5, [:+ :h :star7], 12),
    bg = RGB(0.2, 0.2, 0.2)
)

```

I keep getting the following error:

```julia
UndefVarError: scatter not defined

Stacktrace:
 [1] (::var"#21#22")(309::DataFrame)
   @ Main ./none:0
 [2] top-level scope
   @ In[37]:2
 [3] eval
   @ ./boot.jl:360 [inlined]
 [4] include_string(mapexpr::typeof(REPL.softscope), mod::Module, code::String, filename::String)
   @ Base ./loading.jl:1116

```

I have tried other backends and i get errors like: `MethodError: no method matching getproperty(::Char, ::String)`

Could someone please help me understand what I am doing wrong?  
I am new to julia.

---

<div class="post-metadata">

**Author:** ![vinicius\_de\_lima](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/vinicius_de_lima/32/28717_2.png) [@vinicius\_de\_lima](https://discourse.julialang.org/u/vinicius_de_lima)\
**Post date:** [September 20, 2021, 9:17pm UTC](https://discourse.julialang.org/t/plots-not-working-with-methoderror-or-undefined/68495/2 "2021-09-20T21:17:43Z")

</div>

The third line in the tutorial is:

```julia
iris = dataset("datasets", "iris")

```

Instead of :

```julia
iris = DataFrame(dataset("iris"))

```

I don’t know this package, but maybe this affect something?

---

<div class="post-metadata">

**Author:** ![Hamzah\_Iqbal](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/hamzah_iqbal/32/29355_2.png) [@Hamzah\_Iqbal](https://discourse.julialang.org/u/Hamzah_Iqbal)\
**Post date:** [September 21, 2021, 5:32pm UTC](https://discourse.julialang.org/t/plots-not-working-with-methoderror-or-undefined/68495/3 "2021-09-21T17:32:35Z")

</div>

Hi @vinicius_de_lima, I fixed that part but still get the above errors.

---

<div class="post-metadata">

**Author:** ![vinicius\_de\_lima](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/vinicius_de_lima/32/28717_2.png) [@vinicius\_de\_lima](https://discourse.julialang.org/u/vinicius_de_lima)\
**Post date:** [September 21, 2021, 10:19pm UTC](https://discourse.julialang.org/t/plots-not-working-with-methoderror-or-undefined/68495/4 "2021-09-21T22:19:12Z")

</div>

I tried the tutorial here and it worked. Did you installed StatsPlots and RDatasets?
