update glvisualize
This commit is contained in:
parent
7ec54b9c2e
commit
d4f67ec3b5
@ -10,7 +10,7 @@ TODO
|
|||||||
=#
|
=#
|
||||||
|
|
||||||
@require Revise begin
|
@require Revise begin
|
||||||
Revise.track(Plots, joinpath(Pkg.dir("Plots"), "src", "backends", "glvisualize.jl"))
|
Revise.track(Plots, joinpath(Pkg.dir("Plots"), "src", "backends", "glvisualize.jl"))
|
||||||
end
|
end
|
||||||
|
|
||||||
const _glvisualize_attr = merge_with_base_supported([
|
const _glvisualize_attr = merge_with_base_supported([
|
||||||
@ -24,10 +24,10 @@ const _glvisualize_attr = merge_with_base_supported([
|
|||||||
:markerstrokewidth, :markerstrokecolor, :markerstrokealpha,
|
:markerstrokewidth, :markerstrokecolor, :markerstrokealpha,
|
||||||
:fillrange, :fillcolor, :fillalpha,
|
:fillrange, :fillcolor, :fillalpha,
|
||||||
:bins, :bar_width, :bar_edges, :bar_position,
|
:bins, :bar_width, :bar_edges, :bar_position,
|
||||||
:title, :title_location, :titlefont,
|
:title, :title_location,
|
||||||
:window_title,
|
:window_title,
|
||||||
:guide, :lims, :ticks, :scale, :flip, :rotation,
|
:guide, :lims, :ticks, :scale, :flip, :rotation,
|
||||||
:tickfont, :guidefont, :legendfont,
|
:tickfont, :guidefont, :legendfont, :titlefont,
|
||||||
:grid, :gridalpha, :gridstyle, :gridlinewidth,
|
:grid, :gridalpha, :gridstyle, :gridlinewidth,
|
||||||
:legend, :colorbar,
|
:legend, :colorbar,
|
||||||
:marker_z,
|
:marker_z,
|
||||||
@ -612,7 +612,7 @@ function draw_ticks(
|
|||||||
axis, ticks, isx, isorigin, lims, m, text = "",
|
axis, ticks, isx, isorigin, lims, m, text = "",
|
||||||
positions = Point2f0[], offsets=Vec2f0[]
|
positions = Point2f0[], offsets=Vec2f0[]
|
||||||
)
|
)
|
||||||
sz = pointsize(axis[:tickfont])
|
sz = pointsize(tickfont(axis))
|
||||||
atlas = GLVisualize.get_texture_atlas()
|
atlas = GLVisualize.get_texture_atlas()
|
||||||
font = GLVisualize.defaultfont()
|
font = GLVisualize.defaultfont()
|
||||||
|
|
||||||
@ -745,7 +745,7 @@ function gl_draw_axes_2d(sp::Plots.Subplot{Plots.GLVisualizeBackend}, model, are
|
|||||||
:position => map(x-> x[2], ticklabels),
|
:position => map(x-> x[2], ticklabels),
|
||||||
:offset => map(last, ticklabels),
|
:offset => map(last, ticklabels),
|
||||||
:color => fcolor,
|
:color => fcolor,
|
||||||
:relative_scale => pointsize(xaxis[:tickfont]),
|
:relative_scale => pointsize(tickfont(xaxis)),
|
||||||
:scale_primitive => false
|
:scale_primitive => false
|
||||||
)
|
)
|
||||||
push!(axis_vis, visualize(map(first, ticklabels), Style(:default), kw_args))
|
push!(axis_vis, visualize(map(first, ticklabels), Style(:default), kw_args))
|
||||||
@ -760,7 +760,7 @@ function gl_draw_axes_2d(sp::Plots.Subplot{Plots.GLVisualizeBackend}, model, are
|
|||||||
:position => map(x-> x[2], ticklabels),
|
:position => map(x-> x[2], ticklabels),
|
||||||
:offset => map(last, ticklabels),
|
:offset => map(last, ticklabels),
|
||||||
:color => fcolor,
|
:color => fcolor,
|
||||||
:relative_scale => pointsize(xaxis[:tickfont]),
|
:relative_scale => pointsize(tickfont(xaxis)),
|
||||||
:scale_primitive => false
|
:scale_primitive => false
|
||||||
)
|
)
|
||||||
push!(axis_vis, visualize(map(first, ticklabels), Style(:default), kw_args))
|
push!(axis_vis, visualize(map(first, ticklabels), Style(:default), kw_args))
|
||||||
@ -777,8 +777,8 @@ function gl_draw_axes_2d(sp::Plots.Subplot{Plots.GLVisualizeBackend}, model, are
|
|||||||
|
|
||||||
area_w = GeometryTypes.widths(area)
|
area_w = GeometryTypes.widths(area)
|
||||||
if sp[:title] != ""
|
if sp[:title] != ""
|
||||||
tf = sp[:titlefont]; color = gl_color(sp[:foreground_color_title])
|
tf = titlefont(sp)
|
||||||
font = Plots.Font(tf.family, tf.pointsize, :hcenter, :top, tf.rotation, color)
|
font = Plots.Font(tf.family, tf.pointsize, :hcenter, :top, tf.rotation, tf.color)
|
||||||
xy = Point2f0(area.w/2, area_w[2] + pointsize(tf)/2)
|
xy = Point2f0(area.w/2, area_w[2] + pointsize(tf)/2)
|
||||||
kw = Dict(:model => text_model(font, xy), :scale_primitive => true)
|
kw = Dict(:model => text_model(font, xy), :scale_primitive => true)
|
||||||
extract_font(font, kw)
|
extract_font(font, kw)
|
||||||
@ -786,9 +786,9 @@ function gl_draw_axes_2d(sp::Plots.Subplot{Plots.GLVisualizeBackend}, model, are
|
|||||||
push!(axis_vis, glvisualize_text(xy, t, kw))
|
push!(axis_vis, glvisualize_text(xy, t, kw))
|
||||||
end
|
end
|
||||||
if xaxis[:guide] != ""
|
if xaxis[:guide] != ""
|
||||||
tf = xaxis[:guidefont]; color = gl_color(xaxis[:foreground_color_guide])
|
tf = guidefont(xaxis)
|
||||||
xy = Point2f0(area.w/2, - pointsize(tf)/2)
|
xy = Point2f0(area.w/2, - pointsize(tf)/2)
|
||||||
font = Plots.Font(tf.family, tf.pointsize, :hcenter, :bottom, tf.rotation, color)
|
font = Plots.Font(tf.family, tf.pointsize, :hcenter, :bottom, tf.rotation, tf.color)
|
||||||
kw = Dict(:model => text_model(font, xy), :scale_primitive => true)
|
kw = Dict(:model => text_model(font, xy), :scale_primitive => true)
|
||||||
t = PlotText(xaxis[:guide], font)
|
t = PlotText(xaxis[:guide], font)
|
||||||
extract_font(font, kw)
|
extract_font(font, kw)
|
||||||
@ -796,8 +796,8 @@ function gl_draw_axes_2d(sp::Plots.Subplot{Plots.GLVisualizeBackend}, model, are
|
|||||||
end
|
end
|
||||||
|
|
||||||
if yaxis[:guide] != ""
|
if yaxis[:guide] != ""
|
||||||
tf = yaxis[:guidefont]; color = gl_color(yaxis[:foreground_color_guide])
|
tf = guidefont(yaxis)
|
||||||
font = Plots.Font(tf.family, tf.pointsize, :hcenter, :top, 90f0, color)
|
font = Plots.Font(tf.family, tf.pointsize, :hcenter, :top, 90f0, tf.color)
|
||||||
xy = Point2f0(-pointsize(tf)/2, area.h/2)
|
xy = Point2f0(-pointsize(tf)/2, area.h/2)
|
||||||
kw = Dict(:model => text_model(font, xy), :scale_primitive=>true)
|
kw = Dict(:model => text_model(font, xy), :scale_primitive=>true)
|
||||||
t = PlotText(yaxis[:guide], font)
|
t = PlotText(yaxis[:guide], font)
|
||||||
@ -1483,9 +1483,8 @@ function make_label(sp, series, i)
|
|||||||
else
|
else
|
||||||
series[:label]
|
series[:label]
|
||||||
end
|
end
|
||||||
color = sp[:foreground_color_legend]
|
ft = legendfont(sp)
|
||||||
ft = sp[:legendfont]
|
font = Plots.Font(ft.family, ft.pointsize, :left, :bottom, 0.0, ft.color)
|
||||||
font = Plots.Font(ft.family, ft.pointsize, :left, :bottom, 0.0, color)
|
|
||||||
xy = Point2f0(w+gap, 0.0)
|
xy = Point2f0(w+gap, 0.0)
|
||||||
kw = Dict(:model => text_model(font, xy), :scale_primitive=>false)
|
kw = Dict(:model => text_model(font, xy), :scale_primitive=>false)
|
||||||
extract_font(font, kw)
|
extract_font(font, kw)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user