translate pgf_add_aanotation!
This commit is contained in:
parent
cbc0419c6e
commit
6b6d589aa7
@ -34,6 +34,14 @@ const _pgfplotsx_legend_pos = KW(
|
|||||||
|
|
||||||
const _pgfx_framestyles = [:box, :axes, :origin, :zerolines, :grid, :none]
|
const _pgfx_framestyles = [:box, :axes, :origin, :zerolines, :grid, :none]
|
||||||
const _pgfx_framestyle_defaults = Dict(:semi => :box)
|
const _pgfx_framestyle_defaults = Dict(:semi => :box)
|
||||||
|
|
||||||
|
# we use the anchors to define orientations for example to align left
|
||||||
|
# one needs to use the right edge as anchor
|
||||||
|
const _pgfx_annotation_halign = KW(
|
||||||
|
:center => "",
|
||||||
|
:left => "right",
|
||||||
|
:right => "left"
|
||||||
|
)
|
||||||
## --------------------------------------------------------------------------------------
|
## --------------------------------------------------------------------------------------
|
||||||
function pgfx_framestyle(style::Symbol)
|
function pgfx_framestyle(style::Symbol)
|
||||||
if style in _pgfx_framestyles
|
if style in _pgfx_framestyles
|
||||||
@ -109,15 +117,18 @@ function pgfx_add_annotation!(o, x, y, val, thickness_scaling = 1)
|
|||||||
# Currently supports color and orientation
|
# Currently supports color and orientation
|
||||||
cstr = val.font.color
|
cstr = val.font.color
|
||||||
a = alpha(cstr)
|
a = alpha(cstr)
|
||||||
#TODO: translate this
|
push!(o, ["\\node",
|
||||||
push!(o, PGFPlots.Plots.Node(val.str, # Annotation Text
|
PGFPlotsX.Options(
|
||||||
x, y,
|
get(_pgfx_annotation_halign,val.font.halign,"") => nothing,
|
||||||
style="""
|
"color" => cstr,
|
||||||
$(get(_pgfx_annotation_halign,val.font.halign,"")),
|
"draw opacity" => convert(Float16, a),
|
||||||
color=$cstr, draw opacity=$(convert(Float16,a)),
|
"rotate" => val.font.rotation,
|
||||||
rotate=$(val.font.rotation),
|
"font" => pgfx_font(val.font.pointsize, thickness_scaling)
|
||||||
font=$(pgfx_font(val.font.pointsize, thickness_scaling))
|
),
|
||||||
"""))
|
" at ",
|
||||||
|
PGFPlotsX.Coordinate(x, y),
|
||||||
|
"{$(val.str).};"
|
||||||
|
])
|
||||||
end
|
end
|
||||||
## --------------------------------------------------------------------------------------
|
## --------------------------------------------------------------------------------------
|
||||||
# TODO: translate these if needed
|
# TODO: translate these if needed
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user