Rebase
This commit is contained in:
parent
69aa05b717
commit
70207647c4
@ -701,8 +701,6 @@ function gr_text_size(str, rot)
|
|||||||
xs, ys = gr_inqtext(0, 0, string(str))
|
xs, ys = gr_inqtext(0, 0, string(str))
|
||||||
l, r = extrema(xs)
|
l, r = extrema(xs)
|
||||||
b, t = extrema(ys)
|
b, t = extrema(ys)
|
||||||
w = r - l
|
|
||||||
h = t - b
|
|
||||||
w = text_box_width(r - l, t - b, rot)
|
w = text_box_width(r - l, t - b, rot)
|
||||||
h = text_box_height(r - l, t - b, rot)
|
h = text_box_height(r - l, t - b, rot)
|
||||||
GR.restorestate()
|
GR.restorestate()
|
||||||
@ -716,8 +714,8 @@ function gr_get_ticks_size(ticks, rot)
|
|||||||
w, h = 0.0, 0.0
|
w, h = 0.0, 0.0
|
||||||
for (cv, dv) in zip(ticks...)
|
for (cv, dv) in zip(ticks...)
|
||||||
wi, hi = gr_text_size(dv, rot)
|
wi, hi = gr_text_size(dv, rot)
|
||||||
w = max(w, wi)
|
w = NaNMath.max(w, wi)
|
||||||
h = max(h, hi)
|
h = NaNMath.max(h, hi)
|
||||||
end
|
end
|
||||||
return w, h
|
return w, h
|
||||||
end
|
end
|
||||||
@ -1448,7 +1446,7 @@ end
|
|||||||
|
|
||||||
function gr_draw_axis(sp, letter, viewport_plotarea)
|
function gr_draw_axis(sp, letter, viewport_plotarea)
|
||||||
ax = axis_drawing_info(sp, letter)
|
ax = axis_drawing_info(sp, letter)
|
||||||
axis = sp[Symbol(letter, :axis)]
|
axis = sp[get_attr_symbol(letter, :axis)]
|
||||||
|
|
||||||
# draw segments
|
# draw segments
|
||||||
gr_draw_grid(sp, axis, ax.grid_segments)
|
gr_draw_grid(sp, axis, ax.grid_segments)
|
||||||
@ -1464,7 +1462,7 @@ end
|
|||||||
|
|
||||||
function gr_draw_axis_3d(sp, letter, viewport_plotarea)
|
function gr_draw_axis_3d(sp, letter, viewport_plotarea)
|
||||||
ax = axis_drawing_info_3d(sp, letter)
|
ax = axis_drawing_info_3d(sp, letter)
|
||||||
axis = sp[Symbol(letter, :axis)]
|
axis = sp[get_attr_symbol(letter, :axis)]
|
||||||
|
|
||||||
# draw segments
|
# draw segments
|
||||||
gr_draw_grid(sp, axis, ax.grid_segments, gr_polyline3d)
|
gr_draw_grid(sp, axis, ax.grid_segments, gr_polyline3d)
|
||||||
@ -1545,10 +1543,10 @@ function gr_draw_ticks(sp, axis, segments, func = gr_polyline)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function gr_label_ticks(sp, letter, ticks)
|
function gr_label_ticks(sp, letter, ticks)
|
||||||
axis = sp[Symbol(letter, :axis)]
|
axis = sp[get_attr_symbol(letter, :axis)]
|
||||||
isy = letter === :y
|
isy = letter === :y
|
||||||
oletter = isy ? :x : :y
|
oletter = isy ? :x : :y
|
||||||
oaxis = sp[Symbol(oletter, :axis)]
|
oaxis = sp[get_attr_symbol(oletter, :axis)]
|
||||||
oamin, oamax = axis_limits(sp, oletter)
|
oamin, oamax = axis_limits(sp, oletter)
|
||||||
gr_set_tickfont(sp, letter)
|
gr_set_tickfont(sp, letter)
|
||||||
out_factor = ifelse(axis[:tick_direction] === :out, 1.5, 1)
|
out_factor = ifelse(axis[:tick_direction] === :out, 1.5, 1)
|
||||||
@ -1592,9 +1590,9 @@ function gr_label_ticks_3d(sp, letter, ticks)
|
|||||||
near_letter = letter in (:x, :z) ? :y : :x
|
near_letter = letter in (:x, :z) ? :y : :x
|
||||||
far_letter = letter in (:x, :y) ? :z : :x
|
far_letter = letter in (:x, :y) ? :z : :x
|
||||||
|
|
||||||
ax = sp[Symbol(letter, :axis)]
|
ax = sp[get_attr_symbol(letter, :axis)]
|
||||||
nax = sp[Symbol(near_letter, :axis)]
|
nax = sp[get_attr_symbol(near_letter, :axis)]
|
||||||
fax = sp[Symbol(far_letter, :axis)]
|
fax = sp[get_attr_symbol(far_letter, :axis)]
|
||||||
|
|
||||||
amin, amax = axis_limits(sp, letter)
|
amin, amax = axis_limits(sp, letter)
|
||||||
namin, namax = axis_limits(sp, near_letter)
|
namin, namax = axis_limits(sp, near_letter)
|
||||||
@ -1604,7 +1602,7 @@ function gr_label_ticks_3d(sp, letter, ticks)
|
|||||||
# find out which axes we are dealing with
|
# find out which axes we are dealing with
|
||||||
i = findfirst(==(letter), (:x, :y, :z))
|
i = findfirst(==(letter), (:x, :y, :z))
|
||||||
letters = axes_shift((:x, :y, :z), 1 - i)
|
letters = axes_shift((:x, :y, :z), 1 - i)
|
||||||
asyms = Symbol.(letters, :axis)
|
asyms = get_attr_symbol.(letters, :axis)
|
||||||
|
|
||||||
# get axis objects, ticks and minor ticks
|
# get axis objects, ticks and minor ticks
|
||||||
# regardless of the `letter` we now use the convention that `x` in variable names refer to
|
# regardless of the `letter` we now use the convention that `x` in variable names refer to
|
||||||
@ -1641,7 +1639,7 @@ function gr_label_ticks_3d(sp, letter, ticks)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function gr_label_axis(sp, letter, viewport_plotarea)
|
function gr_label_axis(sp, letter, viewport_plotarea)
|
||||||
axis = sp[Symbol(letter, :axis)]
|
axis = sp[get_attr_symbol(letter, :axis)]
|
||||||
mirror = axis[:mirror]
|
mirror = axis[:mirror]
|
||||||
# guide
|
# guide
|
||||||
if axis[:guide] != ""
|
if axis[:guide] != ""
|
||||||
@ -1685,13 +1683,13 @@ function gr_label_axis(sp, letter, viewport_plotarea)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function gr_label_axis_3d(sp, letter)
|
function gr_label_axis_3d(sp, letter)
|
||||||
ax = sp[Symbol(letter, :axis)]
|
ax = sp[get_attr_symbol(letter, :axis)]
|
||||||
if ax[:guide] != ""
|
if ax[:guide] != ""
|
||||||
near_letter = letter in (:x, :z) ? :y : :x
|
near_letter = letter in (:x, :z) ? :y : :x
|
||||||
far_letter = letter in (:x, :y) ? :z : :x
|
far_letter = letter in (:x, :y) ? :z : :x
|
||||||
|
|
||||||
nax = sp[Symbol(near_letter, :axis)]
|
nax = sp[get_attr_symbol(near_letter, :axis)]
|
||||||
fax = sp[Symbol(far_letter, :axis)]
|
fax = sp[get_attr_symbol(far_letter, :axis)]
|
||||||
|
|
||||||
amin, amax = axis_limits(sp, letter)
|
amin, amax = axis_limits(sp, letter)
|
||||||
namin, namax = axis_limits(sp, near_letter)
|
namin, namax = axis_limits(sp, near_letter)
|
||||||
@ -2098,4 +2096,4 @@ function _display(plt::Plot{GRBackend})
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
closeall(::GRBackend) = GR.emergencyclosegks()
|
closeall(::GRBackend) = GR.emergencyclosegks()
|
||||||
Loading…
x
Reference in New Issue
Block a user