Fix halign for annotations in pgfplots backend

PGFPlot uses inverted right and left parameters.
This commit is contained in:
Sebastian Pech 2017-02-14 21:04:13 +01:00
parent a4549cbfa2
commit 5ae2044d02

View File

@ -98,6 +98,12 @@ const _pgf_series_extrastyle = KW(
:xsticks => "xcomb", :xsticks => "xcomb",
) )
const _pgf_annotation_halign = KW(
:center => "",
:left => "right",
:right => "left"
)
# -------------------------------------------------------------------------------------- # --------------------------------------------------------------------------------------
# takes in color,alpha, and returns color and alpha appropriate for pgf style # takes in color,alpha, and returns color and alpha appropriate for pgf style
@ -139,12 +145,11 @@ end
function pgf_add_annotation!(o,x,y,val) function pgf_add_annotation!(o,x,y,val)
# Construct the style string. # Construct the style string.
# Currently supports color and orientation # Currently supports color and orientation
halign = val.font.halign == :hcenter ? "" : string(val.font.halign)
cstr,a = pgf_color(val.font.color) cstr,a = pgf_color(val.font.color)
push!(o, PGFPlots.Plots.Node(val.str, # Annotation Text push!(o, PGFPlots.Plots.Node(val.str, # Annotation Text
x, y, x, y,
style=""" style="""
$halign, $(get(_pgf_annotation_halign,val.font.halign,"")),
color=$cstr, draw opacity=$(convert(Float16,a)), color=$cstr, draw opacity=$(convert(Float16,a)),
rotate=$(val.font.rotation) rotate=$(val.font.rotation)
""")) """))