free shapes
This commit is contained in:
parent
607640ce73
commit
2bbaf9d504
@ -158,8 +158,8 @@ function (pgfx_plot::PGFPlotsXPlot)(plt::Plot{PGFPlotsXBackend})
|
|||||||
)
|
)
|
||||||
end
|
end
|
||||||
# treat segments
|
# treat segments
|
||||||
segments = if iscontour(series) || st == :heatmap
|
segments = if st in (:wireframe, :heatmap, :contour, :surface)
|
||||||
iter_segments(series[:x], series[:y])
|
iter_segments(surface_to_vecs(series[:x], series[:y], series[:z])...)
|
||||||
else
|
else
|
||||||
iter_segments(series)
|
iter_segments(series)
|
||||||
end
|
end
|
||||||
@ -167,6 +167,21 @@ function (pgfx_plot::PGFPlotsXPlot)(plt::Plot{PGFPlotsXBackend})
|
|||||||
for (i, rng) in enumerate(segments)
|
for (i, rng) in enumerate(segments)
|
||||||
segment_opt = merge( segment_opt, pgfx_linestyle(opt, i) )
|
segment_opt = merge( segment_opt, pgfx_linestyle(opt, i) )
|
||||||
if opt[:markershape] != :none #|| !iscontour(series) && !(st == :heatmap)
|
if opt[:markershape] != :none #|| !iscontour(series) && !(st == :heatmap)
|
||||||
|
marker = opt[:markershape]
|
||||||
|
if marker isa Shape
|
||||||
|
x = marker.x
|
||||||
|
y = marker.y
|
||||||
|
scale_factor = 0.025
|
||||||
|
mark_size = opt[:markersize] * scale_factor
|
||||||
|
path = join(["($(x[i] * mark_size), $(y[i] * mark_size))" for i in eachindex(x)], " -- ")
|
||||||
|
PGFPlotsX.push_preamble!(pgfx_plot.the_plot,
|
||||||
|
"""
|
||||||
|
\\pgfdeclareplotmark{PlotsShape}{
|
||||||
|
\\draw $path;
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
end
|
||||||
segment_opt = merge( segment_opt, pgfx_marker(opt, i) )
|
segment_opt = merge( segment_opt, pgfx_marker(opt, i) )
|
||||||
end
|
end
|
||||||
if st == :shape || series[:fillrange] !== nothing
|
if st == :shape || series[:fillrange] !== nothing
|
||||||
@ -300,8 +315,11 @@ function pgfx_series_coordinates!(st_val::Val{:xsticks}, segment_opt, opt, args)
|
|||||||
return PGFPlotsX.Coordinates(args...)
|
return PGFPlotsX.Coordinates(args...)
|
||||||
end
|
end
|
||||||
function pgfx_series_coordinates!(st_val::Val{:surface}, segment_opt, opt, args)
|
function pgfx_series_coordinates!(st_val::Val{:surface}, segment_opt, opt, args)
|
||||||
|
@show collect(args)[3] |> length
|
||||||
|
@show args
|
||||||
push!( segment_opt, "surf" => nothing,
|
push!( segment_opt, "surf" => nothing,
|
||||||
"mesh/rows" => length(opt[:x])
|
"mesh/rows" => length(opt[:x]),
|
||||||
|
"mesh/cols" => length(opt[:y]),
|
||||||
)
|
)
|
||||||
return PGFPlotsX.Coordinates(args...)
|
return PGFPlotsX.Coordinates(args...)
|
||||||
end
|
end
|
||||||
@ -316,7 +334,7 @@ function pgfx_series_coordinates!(st_val::Val{:wireframe}, segment_opt, opt, arg
|
|||||||
return PGFPlotsX.Coordinates(args...)
|
return PGFPlotsX.Coordinates(args...)
|
||||||
end
|
end
|
||||||
function pgfx_series_coordinates!(st_val::Val{:shape}, segment_opt, opt, args)
|
function pgfx_series_coordinates!(st_val::Val{:shape}, segment_opt, opt, args)
|
||||||
push!( segment_opt, "area legends" => nothing, "patch" => nothing )
|
push!( segment_opt, "area legends" => nothing )
|
||||||
return PGFPlotsX.Coordinates(args...)
|
return PGFPlotsX.Coordinates(args...)
|
||||||
end
|
end
|
||||||
function pgfx_series_coordinates!(st_val::Val{:contour}, segment_opt, opt, args)
|
function pgfx_series_coordinates!(st_val::Val{:contour}, segment_opt, opt, args)
|
||||||
@ -459,9 +477,10 @@ function pgfx_marker(plotattributes, i = 1)
|
|||||||
a = alpha(cstr)
|
a = alpha(cstr)
|
||||||
cstr_stroke = plot_color(get_markerstrokecolor(plotattributes, i), get_markerstrokealpha(plotattributes, i))
|
cstr_stroke = plot_color(get_markerstrokecolor(plotattributes, i), get_markerstrokealpha(plotattributes, i))
|
||||||
a_stroke = alpha(cstr_stroke)
|
a_stroke = alpha(cstr_stroke)
|
||||||
|
mark_size = pgfx_thickness_scaling(plotattributes) * 0.5 * _cycle(plotattributes[:markersize], i)
|
||||||
return PGFPlotsX.Options(
|
return PGFPlotsX.Options(
|
||||||
"mark" => get(_pgfplotsx_markers, shape, "*"),
|
"mark" => shape isa Shape ? "PlotsShape" : get(_pgfplotsx_markers, shape, "*"),
|
||||||
"mark size" => pgfx_thickness_scaling(plotattributes) * 0.5 * _cycle(plotattributes[:markersize], i),
|
"mark size" => "$mark_size pt",
|
||||||
"mark options" => PGFPlotsX.Options(
|
"mark options" => PGFPlotsX.Options(
|
||||||
"color" => cstr_stroke,
|
"color" => cstr_stroke,
|
||||||
"draw opacity" => a_stroke,
|
"draw opacity" => a_stroke,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user