# -*- coding: utf-8 -*-
# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .jl
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Julia 1.2.0
#     language: julia
#     name: julia-1.2
# ---

using GR
GR.__init__()

using PackageCompiler
compile_incremental("GR", joinpath(dirname(pathof(GR)), "..", "examples", "snoop.jl"))

using Random
rng = MersenneTwister(1234);

x = 0:π/100:2π
y = sin.(x)
plot(x, y)

x = LinRange(0, 1, 51)
y = x .- x.^2
scatter(x, y)

sz = LinRange(50, 300, length(x))
c = LinRange(0, 255, length(x))
scatter(x, y, sz, c)

stem(x, y)

histogram(randn(rng, 10000))

plot(randn(50))

oplot(randn(50,3))

x = LinRange(0, 30, 1000)
y = cos.(x) .* x
z = sin.(x) .* x
plot3(x, y, z)

angles = LinRange(0, 2pi, 40)
radii = LinRange(0, 2, 40)
polar(angles, radii)

x = 2 .* rand(rng, 100) .- 1
y = 2 .* rand(rng, 100) .- 1
z = 2 .* rand(rng, 100) .- 1
scatter3(x, y, z)

c = 999 .* rand(rng, 100) .+ 1
scatter3(x, y, z, c)

x = randn(rng, 100000)
y = randn(rng, 100000)
hexbin(x, y)

x = 8 .* rand(rng, 100) .- 4
y = 8 .* rand(rng, 100) .- 4
z = sin.(x) .+ cos.(y)
contour(x, y, z)

X = LinRange(-2, 2, 40)
Y = LinRange(0, pi, 20)
x, y = meshgrid(X, Y)
z = sin.(x) .+ cos.(y)
contour(x, y, z)

x = 8 .* rand(rng, 100) .- 4
y = 8 .* rand(rng, 100) .- 4
z = sin.(x) .+ cos.(y)
contourf(x, y, z)

X = LinRange(-2, 2, 40)
Y = LinRange(0, pi, 20)
x, y = GR.meshgrid(X, Y)
z = sin.(x) .+ cos.(y)
contourf(x, y, z)

x = 8 .* rand(rng, 100) .- 4
y = 8 .* rand(rng, 100) .- 4
z = sin.(x) + cos.(y)
tricont(x, y, z)

x = 8 .* rand(rng, 100) .- 4
y = 8 .* rand(rng, 100) .- 4
z = sin.(x) .+ cos.(y)
surface(x, y, z)

X = LinRange(-2, 2, 40)
Y = LinRange(0, pi, 20)
x, y = meshgrid(X, Y)
z = sin.(x) .+ cos.(y)
surface(x, y, z)

x = 8 .* rand(rng, 100) .- 4
y = 8 .* rand(rng, 100) .- 4
z = sin.(x) .+ cos.(y)
GR.trisurf(x, y, z)

x = 8 .* rand(rng, 100) .- 4
y = 8 .* rand(rng, 100) .- 4
z = sin.(x) .+ cos.(y)
wireframe(x, y, z)

X = LinRange(-2, 2, 40)
Y = LinRange(0, pi, 20)
x, y = meshgrid(X, Y)
z = sin.(x) .+ cos.(y)
wireframe(x, y, z)

# Create example data
X = LinRange(-2, 2, 40)
Y = LinRange(0, pi, 20)
x, y = meshgrid(X, Y)
z = sin.(x) .+ cos.(y)
heatmap(z)

imshow(z)

s = LinRange(-1, 1, 40)
x, y, z = GR.meshgrid(s, s, s)
v = 1 .- (x .^ 2 .+ y .^ 2 .+ z .^ 2) .^ 0.5
isosurface(v, isovalue=0.2)

GR.GR3.terminate()

volume(randn(rng, 50, 50, 50))

N = 1_000_000
x = randn(rng, N)
y = randn(rng, N)
shade(x, y)

StarcoderdataJupyterScriptsDedupFiltered