Merge 9ea78af4a288962bcb14d36981d1bee9836b90ef into 226bf7e70555e01f0581943162e3612bb6523bb4

This commit is contained in:
Pearl Li 2017-10-23 21:19:25 +00:00 committed by GitHub
commit c49ac040fe

View File

@ -20,7 +20,7 @@ const _gr_attr = merge_with_base_supported([
:fillrange, :fillcolor, :fillalpha,
:bins,
:layout,
:title, :window_title,
:title, :title_location, :window_title,
:guide, :lims, :ticks, :scale, :flip,
:tickfont, :guidefont, :legendfont,
:grid, :gridalpha, :gridstyle, :gridlinewidth,
@ -863,9 +863,17 @@ function gr_display(sp::Subplot{GRBackend}, w, h, viewport_canvas)
GR.savestate()
if sp[:title] != ""
gr_set_font(sp[:titlefont])
GR.settextalign(GR.TEXT_HALIGN_CENTER, GR.TEXT_VALIGN_TOP)
gr_set_textcolor(sp[:foreground_color_title])
gr_text(gr_view_xcenter(), viewport_subplot[4], sp[:title])
if sp[:title_location] == :left
GR.settextalign(GR.TEXT_HALIGN_LEFT, GR.TEXT_VALIGN_TOP)
gr_text(viewport_plotarea[1], viewport_subplot[4], sp[:title])
elseif sp[:title_location] == :right
GR.settextalign(GR.TEXT_HALIGN_RIGHT, GR.TEXT_VALIGN_TOP)
gr_text(viewport_plotarea[2], viewport_subplot[4], sp[:title])
else
GR.settextalign(GR.TEXT_HALIGN_CENTER, GR.TEXT_VALIGN_TOP)
gr_text(gr_view_xcenter(), viewport_subplot[4], sp[:title])
end
end
if xaxis[:guide] != ""