Skip to content
This repository has been archived by the owner on Dec 16, 2021. It is now read-only.

Commit

Permalink
Merge pull request #36 from JuliaPlots/sd-update
Browse files Browse the repository at this point in the history
update examples
  • Loading branch information
SimonDanisch authored Apr 9, 2019
2 parents 22ace94 + dcf7459 commit 726f09f
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 17 deletions.
2 changes: 1 addition & 1 deletion docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ if !haskey(ENV, "DOCUMENTER_KEY")
ENV["TRAVIS_BRANCH"] = "latest"
ENV["TRAVIS_PULL_REQUEST"] = "false"
ENV["TRAVIS_REPO_SLUG"] = "github.com/JuliaPlots/MakieGallery.jl.git"
ENV["TRAVIS_TAG"] = "v0.9.6"
ENV["TRAVIS_TAG"] = "v4"
ENV["TRAVIS_OS_NAME"] = ""
ENV["TRAVIS_JULIA_VERSION"] = ""
ENV["PATH"] = string(ENV["PATH"], Sys.iswindows() ? ";" : ":", Conda.SCRIPTDIR)
Expand Down
5 changes: 2 additions & 3 deletions examples/documentation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
offset = 0.1
scene = Scene()
cam2d!(scene)
plot = map(AbstractPlotting.all_gradient_names) do cmap
plot = map(collect(AbstractPlotting.all_gradient_names)) do cmap
global h
c = to_colormap(cmap)
cbar = image!(
Expand Down Expand Up @@ -231,12 +231,11 @@
end

@cell "Stepper demo" [stepper, text, annotation] begin

function stepper_demo()
scene = Scene()
pos = (50, 50)
steps = ["Step 1", "Step 2", "Step 3"]
colors = AbstractPlotting.to_colormap(:Set1, length(steps))
colors = AbstractPlotting.ColorBrewer.palette("Set1", length(steps))
lines!(scene, Rect(0,0,500,500), linewidth = 0.0001)
# initialize the stepper and give it an output destination
st = Stepper(scene, @replace_with_a_path)
Expand Down
26 changes: 16 additions & 10 deletions examples/examples2d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
arrows!(x, y, u, v, arrowsize = 0.05)
end
@cell "image" [image] begin
hbox(
vbox(
image(AbstractPlotting.logo(), scale_plot = false),
image(rand(100, 500), scale_plot = false),
)
Expand Down Expand Up @@ -303,6 +303,15 @@
step!(st)
st
end

@cell "linesegments + colors" [linesegments] begin
using Colors
linesegments(
[rand(Point2f0) => rand(Point2f0) for i in 1:5],
color = rand(RGB{Float64}, 5)
)
end

@cell "Parallel Prefix Sum" [lines, scatter] begin
# credits to [jiahao chen](https://github.com/jiahao)

Expand Down Expand Up @@ -440,21 +449,18 @@ end
)

end


end

@block AnshulSinghvi ["Recipes"] begin

@cell "Arc" [arc] begin

arc(
[0, 0], # origin
s = arc(
Point2f0(0, 0), # origin
1, # radius
0, # start angle
pi # end angle
)

)
s
end

end
20 changes: 18 additions & 2 deletions src/database.jl
Original file line number Diff line number Diff line change
Expand Up @@ -533,10 +533,26 @@ function eval_example(
steps = split(source, "@substep", keepempty = false)
Random.seed!(42)
if length(steps) == 1
return include_string(tmpmod, source, string(uname))
try
return include_string(tmpmod, source, string(uname))
catch e
println(stderr, "Example $(entry.title) failed with source:")
for line in split(source, "\n")
println(stderr, " ", line)
end
rethrow(e)
end
else
return map(enumerate(steps)) do (i, source)
include_string(tmpmod, source, string(uname, "_", i))
try
return include_string(tmpmod, source, string(uname, "_", i))
catch e
println(stderr, "Example $(entry.title) failed with source:")
for line in split(source, "\n")
println(stderr, " ", line)
end
rethrow(e)
end
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion src/testruns.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const makiegallery_dir = abspath(first(Base.DEPOT_PATH), "makiegallery")
"""
Downloads the reference images from ReferenceImages for a specific version
"""
function download_reference(version = v"0.1.5")
function download_reference(version = v"0.1.6")
download_dir = joinpath(makiegallery_dir, "testimages")
isdir(download_dir) || mkpath(download_dir)
tarfile = joinpath(download_dir, "gallery.zip")
Expand Down
2 changes: 2 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,6 @@ rm(test_record_path, force = true, recursive = true)
mkpath(test_record_path)
# THese examples download additional data - don't want to deal with that!
examples = MakieGallery.record_examples(test_record_path)
# MakieGallery.generate_preview(test_record_path, joinpath(homedir(), "Desktop", "index.html"))
# MakieGallery.generate_thumbnails(test_record_path)
MakieGallery.run_comparison(test_record_path, tested_diff_path)
2 changes: 2 additions & 0 deletions test/upgrade_recordings.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
repo = joinpath(homedir(), "ReferenceImages", "gallery")
MakieGallery.generate_thumbnails(repo)

recordings = joinpath(@__DIR__, "test_recordings")
cp(recordings, repo, force = true)

0 comments on commit 726f09f

Please sign in to comment.