status quo

This commit is contained in:
Simon Christ 2019-11-19 15:31:36 +01:00
parent fb418c87ac
commit c0fc671a83
2 changed files with 39 additions and 1 deletions

View File

@ -535,13 +535,13 @@ function _update_plot_object(plt::Plot{PGFPlotsXBackend})
end end
series_opt = PGFPlotsX.Options( series_opt = PGFPlotsX.Options(
"color" => opt[:linecolor], "color" => opt[:linecolor],
"scatter" => nothing,
) )
if st == :shape if st == :shape
push!(series_opt, "area legend" => nothing) push!(series_opt, "area legend" => nothing)
end end
if opt[:marker_z] !== nothing if opt[:marker_z] !== nothing
push!(series_opt, "point meta" => "explicit") push!(series_opt, "point meta" => "explicit")
push!(series_opt, "scatter" => nothing)
end end
segments = iter_segments(series) segments = iter_segments(series)
segment_opt = PGFPlotsX.Options() segment_opt = PGFPlotsX.Options()
@ -569,6 +569,9 @@ function _update_plot_object(plt::Plot{PGFPlotsXBackend})
else else
series_func = PGFPlotsX.Plot series_func = PGFPlotsX.Plot
end end
if st == :scatter
push!(series_opt, "only marks" => nothing)
end
series_plot = series_func( series_plot = series_func(
merge(series_opt, segment_opt), merge(series_opt, segment_opt),
PGFPlotsX.Coordinates(args..., meta = opt[:marker_z]) PGFPlotsX.Coordinates(args..., meta = opt[:marker_z])

View File

@ -27,4 +27,39 @@ end
@test pgfx_plot.o.contents[1]["colorbar"] === nothing @test pgfx_plot.o.contents[1]["colorbar"] === nothing
end end
end # testset end # testset
@testset "Color docs example" begin
y = rand(100)
plot(0:10:100, rand(11, 4), lab="lines", w=3, palette=:grays, fill=0, α=0.6)
scatter!(y, zcolor=abs.(y .- 0.5), m=(:heat, 0.8, Plots.stroke(1, :green)), ms=10 * abs.(y .- 0.5) .+ 4, lab="grad")
# TODO: marker size does not adjust
# TODO: marker stroke is incorrect
# TODO: fill legends
# TODO: adjust colorbar limits to data
end # testset
@testset "Plot in pieces" begin
plot(rand(100) / 3, reg=true, fill=(0, :green))
scatter!(rand(100), markersize=6, c=:orange)
# TODO: legends should be different
end # testset
@testset "Marker types" begin
markers = filter((m->begin
m in Plots.supported_markers()
end), Plots._shape_keys)
markers = reshape(markers, 1, length(markers))
n = length(markers)
x = (range(0, stop=10, length=n + 2))[2:end - 1]
y = repeat(reshape(reverse(x), 1, :), n, 1)
scatter(x, y, m=(8, :auto), lab=map(string, markers), bg=:linen, xlim=(0, 10), ylim=(0, 10))
#TODO: fix markers that show up as circles
end # testset
@testset "Layout" begin
plot(Plots.fakedata(100, 10), layout=4, palette=[:grays :blues :heat :lightrainbow], bg_inside=[:orange :pink :darkblue :black])
# TODO: add layouting
end # testset
@testset "Polar plots" begin
Θ = range(0, stop=1.5π, length=100)
r = abs.(0.1 * randn(100) + sin.(3Θ))
plot(Θ, r, proj=:polar, m=2)
# TODO: handle polar plots
end # testset
end # testset end # testset