update gr
This commit is contained in:
parent
ba3e75e710
commit
0da6f6b4a4
@ -22,7 +22,14 @@ const _gr_attr = merge_with_base_supported([
|
|||||||
:layout,
|
:layout,
|
||||||
:title, :window_title,
|
:title, :window_title,
|
||||||
:guide, :lims, :ticks, :scale, :flip,
|
:guide, :lims, :ticks, :scale, :flip,
|
||||||
:tickfont, :guidefont, :legendfont,
|
:titlefontfamily, :titlefontsize, :titlefonthalign, :titlefontvalign,
|
||||||
|
:titlefontrotation, :titlefontcolor,
|
||||||
|
:legendfontfamily, :legendfontsize, :legendfonthalign, :legendfontvalign,
|
||||||
|
:legendfontrotation, :legendfontcolor,
|
||||||
|
:tickfontfamily, :tickfontsize, :tickfonthalign, :tickfontvalign,
|
||||||
|
:tickfontrotation, :tickfontcolor,
|
||||||
|
:guidefontfamily, :guidefontsize, :guidefonthalign, :guidefontvalign,
|
||||||
|
:guidefontrotation, :guidefontcolor,
|
||||||
:grid, :gridalpha, :gridstyle, :gridlinewidth,
|
:grid, :gridalpha, :gridstyle, :gridlinewidth,
|
||||||
:legend, :legendtitle, :colorbar,
|
:legend, :legendtitle, :colorbar,
|
||||||
:fill_z, :line_z, :marker_z, :levels,
|
:fill_z, :line_z, :marker_z, :levels,
|
||||||
@ -583,10 +590,9 @@ end
|
|||||||
function gr_set_xticks_font(sp)
|
function gr_set_xticks_font(sp)
|
||||||
flip = sp[:yaxis][:flip]
|
flip = sp[:yaxis][:flip]
|
||||||
mirror = sp[:xaxis][:mirror]
|
mirror = sp[:xaxis][:mirror]
|
||||||
gr_set_font(sp[:xaxis][:tickfont],
|
gr_set_font(tickfont(sp[:xaxis]),
|
||||||
halign = (:left, :hcenter, :right)[sign(sp[:xaxis][:rotation]) + 2],
|
halign = (:left, :hcenter, :right)[sign(sp[:xaxis][:rotation]) + 2],
|
||||||
valign = (mirror ? :bottom : :top),
|
valign = (mirror ? :bottom : :top),
|
||||||
color = sp[:xaxis][:foreground_color_axis],
|
|
||||||
rotation = sp[:xaxis][:rotation])
|
rotation = sp[:xaxis][:rotation])
|
||||||
return flip, mirror
|
return flip, mirror
|
||||||
end
|
end
|
||||||
@ -595,10 +601,9 @@ end
|
|||||||
function gr_set_yticks_font(sp)
|
function gr_set_yticks_font(sp)
|
||||||
flip = sp[:xaxis][:flip]
|
flip = sp[:xaxis][:flip]
|
||||||
mirror = sp[:yaxis][:mirror]
|
mirror = sp[:yaxis][:mirror]
|
||||||
gr_set_font(sp[:yaxis][:tickfont],
|
gr_set_font(tickfont(sp[:yaxis]),
|
||||||
halign = (mirror ? :left : :right),
|
halign = (mirror ? :left : :right),
|
||||||
valign = (:top, :vcenter, :bottom)[sign(sp[:yaxis][:rotation]) + 2],
|
valign = (:top, :vcenter, :bottom)[sign(sp[:yaxis][:rotation]) + 2],
|
||||||
color = sp[:yaxis][:foreground_color_axis],
|
|
||||||
rotation = sp[:yaxis][:rotation])
|
rotation = sp[:yaxis][:rotation])
|
||||||
return flip, mirror
|
return flip, mirror
|
||||||
end
|
end
|
||||||
@ -759,8 +764,7 @@ function gr_display(sp::Subplot{GRBackend}, w, h, viewport_canvas)
|
|||||||
end
|
end
|
||||||
|
|
||||||
# draw the axes
|
# draw the axes
|
||||||
gr_set_font(xaxis[:tickfont])
|
gr_set_font(tickfont(xaxis))
|
||||||
gr_set_textcolor(xaxis[:foreground_color_text])
|
|
||||||
GR.setlinewidth(1)
|
GR.setlinewidth(1)
|
||||||
|
|
||||||
if is3d(sp)
|
if is3d(sp)
|
||||||
@ -887,7 +891,7 @@ function gr_display(sp::Subplot{GRBackend}, w, h, viewport_canvas)
|
|||||||
# add the guides
|
# add the guides
|
||||||
GR.savestate()
|
GR.savestate()
|
||||||
if sp[:title] != ""
|
if sp[:title] != ""
|
||||||
gr_set_font(sp[:titlefont])
|
gr_set_font(titlefont(sp))
|
||||||
loc = sp[:title_location]
|
loc = sp[:title_location]
|
||||||
if loc == :left
|
if loc == :left
|
||||||
xpos = viewport_plotarea[1]
|
xpos = viewport_plotarea[1]
|
||||||
@ -905,22 +909,20 @@ function gr_display(sp::Subplot{GRBackend}, w, h, viewport_canvas)
|
|||||||
end
|
end
|
||||||
|
|
||||||
if xaxis[:guide] != ""
|
if xaxis[:guide] != ""
|
||||||
gr_set_font(xaxis[:guidefont])
|
gr_set_font(guidefont(xaxis))
|
||||||
GR.settextalign(GR.TEXT_HALIGN_CENTER, GR.TEXT_VALIGN_BOTTOM)
|
GR.settextalign(GR.TEXT_HALIGN_CENTER, GR.TEXT_VALIGN_BOTTOM)
|
||||||
gr_set_textcolor(xaxis[:foreground_color_guide])
|
|
||||||
gr_text(gr_view_xcenter(), viewport_subplot[3], xaxis[:guide])
|
gr_text(gr_view_xcenter(), viewport_subplot[3], xaxis[:guide])
|
||||||
end
|
end
|
||||||
|
|
||||||
if yaxis[:guide] != ""
|
if yaxis[:guide] != ""
|
||||||
gr_set_font(yaxis[:guidefont])
|
gr_set_font(guidefont(yaxis))
|
||||||
GR.settextalign(GR.TEXT_HALIGN_CENTER, GR.TEXT_VALIGN_TOP)
|
GR.settextalign(GR.TEXT_HALIGN_CENTER, GR.TEXT_VALIGN_TOP)
|
||||||
GR.setcharup(-1, 0)
|
GR.setcharup(-1, 0)
|
||||||
gr_set_textcolor(yaxis[:foreground_color_guide])
|
|
||||||
gr_text(viewport_subplot[1], gr_view_ycenter(), yaxis[:guide])
|
gr_text(viewport_subplot[1], gr_view_ycenter(), yaxis[:guide])
|
||||||
end
|
end
|
||||||
GR.restorestate()
|
GR.restorestate()
|
||||||
|
|
||||||
gr_set_font(xaxis[:tickfont])
|
gr_set_font(tickfont(xaxis))
|
||||||
|
|
||||||
# this needs to be here to point the colormap to the right indices
|
# this needs to be here to point the colormap to the right indices
|
||||||
GR.setcolormap(1000 + GR.COLORMAP_COOLWARM)
|
GR.setcolormap(1000 + GR.COLORMAP_COOLWARM)
|
||||||
@ -1193,7 +1195,7 @@ function gr_display(sp::Subplot{GRBackend}, w, h, viewport_canvas)
|
|||||||
GR.savestate()
|
GR.savestate()
|
||||||
GR.selntran(0)
|
GR.selntran(0)
|
||||||
GR.setscale(0)
|
GR.setscale(0)
|
||||||
gr_set_font(sp[:legendfont])
|
gr_set_font(legendfont(sp))
|
||||||
w = 0
|
w = 0
|
||||||
i = 0
|
i = 0
|
||||||
n = 0
|
n = 0
|
||||||
@ -1215,7 +1217,7 @@ function gr_display(sp::Subplot{GRBackend}, w, h, viewport_canvas)
|
|||||||
w = max(w, tbx[3] - tbx[1])
|
w = max(w, tbx[3] - tbx[1])
|
||||||
end
|
end
|
||||||
if w > 0
|
if w > 0
|
||||||
dy = _gr_point_mult[1] * sp[:legendfont].pointsize * 1.75
|
dy = _gr_point_mult[1] * sp[:legendfontsize] * 1.75
|
||||||
h = dy*n
|
h = dy*n
|
||||||
(xpos,ypos) = gr_legend_pos(sp[:legend],w,h)
|
(xpos,ypos) = gr_legend_pos(sp[:legend],w,h)
|
||||||
GR.setfillintstyle(GR.INTSTYLE_SOLID)
|
GR.setfillintstyle(GR.INTSTYLE_SOLID)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user