annotations

This commit is contained in:
Daniel Schwabeneder 2018-06-23 23:44:43 +02:00
parent 652e2f27b6
commit 2652990432

View File

@ -201,7 +201,7 @@ function pgf_marker(d, i = 1)
}""" }"""
end end
function pgf_add_annotation!(o,x,y,val) function pgf_add_annotation!(o, x, y, val, thickness_scaling = 1)
# Construct the style string. # Construct the style string.
# Currently supports color and orientation # Currently supports color and orientation
cstr,a = pgf_color(val.font.color) cstr,a = pgf_color(val.font.color)
@ -210,7 +210,8 @@ function pgf_add_annotation!(o,x,y,val)
style=""" style="""
$(get(_pgf_annotation_halign,val.font.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),
font=$(pgf_font(val.font.pointsize, thickness_scaling))
""")) """))
end end
@ -578,13 +579,13 @@ function _update_plot_object(plt::Plot{PGFPlotsBackend})
# add series annotations # add series annotations
anns = series[:series_annotations] anns = series[:series_annotations]
for (xi,yi,str,fnt) in EachAnn(anns, series[:x], series[:y]) for (xi,yi,str,fnt) in EachAnn(anns, series[:x], series[:y])
pgf_add_annotation!(o, xi, yi, PlotText(str, fnt)) pgf_add_annotation!(o, xi, yi, PlotText(str, fnt), pgf_thickness_scaling(series))
end end
end end
# add the annotations # add the annotations
for ann in sp[:annotations] for ann in sp[:annotations]
pgf_add_annotation!(o, locate_annotation(sp, ann...)...) pgf_add_annotation!(o, locate_annotation(sp, ann...)..., pgf_thickness_scaling(sp))
end end