Skip to content

Add Colour Legend to geom_tile Code Example #210

@Jigyasu4indp

Description

@Jigyasu4indp

Yet this code does not show the colour legend.

function mandelbrot(x, y)
    z = c = x + y*im
    for i in 1:30.0
        abs(z) > 2 && return i
        z = z^2 + c
    end
    return 0
end

xs = -2:0.01:1
ys = -1.1:0.01:1.1
xys = Iterators.product(xs, ys) |> collect |> vec
zs = map(xy -> mandelbrot(xy[1], xy[2]), xys)

df_mandelbrot = DataFrame(
    x = first.(xys),
    y = last.(xys),
    z = zs
)

ggplot(df_mandelbrot, @aes(x = x, y = y, z = z)) +
    geom_tile() 

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions