Format .jl files [skip ci] (#3872)
Co-authored-by: t-bltg <t-bltg@users.noreply.github.com>
This commit is contained in:
parent
d34c9b903f
commit
dcd06ec11c
@ -712,7 +712,7 @@ text_box_height(w, h, rot) = abs(sind(rot)) * w + abs(sind(rot + 90)) * h
|
|||||||
|
|
||||||
function gr_get_3d_axis_angle(cvs, nt, ft, letter)
|
function gr_get_3d_axis_angle(cvs, nt, ft, letter)
|
||||||
length(cvs) < 2 && return 0
|
length(cvs) < 2 && return 0
|
||||||
tickpoints = [gr_w3tondc(sort_3d_axes(cv, nt, ft, letter)...) for cv ∈ cvs]
|
tickpoints = [gr_w3tondc(sort_3d_axes(cv, nt, ft, letter)...) for cv in cvs]
|
||||||
|
|
||||||
dx = tickpoints[2][1] - tickpoints[1][1]
|
dx = tickpoints[2][1] - tickpoints[1][1]
|
||||||
dy = tickpoints[2][2] - tickpoints[1][2]
|
dy = tickpoints[2][2] - tickpoints[1][2]
|
||||||
@ -1564,16 +1564,16 @@ function gr_label_ticks(sp, letter, ticks)
|
|||||||
out_factor = ifelse(axis[:tick_direction] === :out, 1.5, 1)
|
out_factor = ifelse(axis[:tick_direction] === :out, 1.5, 1)
|
||||||
x_base_offset = isy ? -1.5e-2 * out_factor : 0
|
x_base_offset = isy ? -1.5e-2 * out_factor : 0
|
||||||
y_base_offset = isy ? 0 : -8e-3 * out_factor
|
y_base_offset = isy ? 0 : -8e-3 * out_factor
|
||||||
|
|
||||||
rot = axis[:rotation] % 360
|
rot = axis[:rotation] % 360
|
||||||
ov = sp[:framestyle] == :origin ? 0 : xor(oaxis[:flip], axis[:mirror]) ? oamax : oamin
|
ov = sp[:framestyle] == :origin ? 0 : xor(oaxis[:flip], axis[:mirror]) ? oamax : oamin
|
||||||
sgn = axis[:mirror] ? -1 : 1
|
sgn = axis[:mirror] ? -1 : 1
|
||||||
sgn2 = iseven(Int(floor(rot / 90))) ? -1 : 1
|
sgn2 = iseven(Int(floor(rot / 90))) ? -1 : 1
|
||||||
sgn3 = if isy
|
sgn3 = if isy
|
||||||
-360 < rot < -180 || 0 < rot < 180 ? 1 : -1
|
-360 < rot < -180 || 0 < rot < 180 ? 1 : -1
|
||||||
else
|
else
|
||||||
rot < -270 || -90 < rot < 90 || rot > 270 ? 1 : -1
|
rot < -270 || -90 < rot < 90 || rot > 270 ? 1 : -1
|
||||||
end
|
end
|
||||||
for (cv, dv) in zip(ticks...)
|
for (cv, dv) in zip(ticks...)
|
||||||
x, y = GR.wctondc(reverse_if((cv, ov), isy)...)
|
x, y = GR.wctondc(reverse_if((cv, ov), isy)...)
|
||||||
sz_rot = gr_text_size(dv, rot)
|
sz_rot = gr_text_size(dv, rot)
|
||||||
@ -1644,35 +1644,40 @@ function gr_label_ticks_3d(sp, letter, ticks)
|
|||||||
|
|
||||||
sgn2a = sgn2b = sgn3 = 0
|
sgn2a = sgn2b = sgn3 = 0
|
||||||
if axisθ != 0 || rot % 90 != 0
|
if axisθ != 0 || rot % 90 != 0
|
||||||
sgn2a = (axisθ != 90) &&
|
sgn2a =
|
||||||
(axisθ == 0 && (rot < 90 || 180 ≤ rot < 270)) ||
|
(axisθ != 90) && (axisθ == 0 && (rot < 90 || 180 ≤ rot < 270)) ||
|
||||||
(axisθ == 270) ||
|
(axisθ == 270) ||
|
||||||
(axisθ < 90 && (axisθ < rot < 90 || axisθ + 180 < rot < 270)) ||
|
(axisθ < 90 && (axisθ < rot < 90 || axisθ + 180 < rot < 270)) ||
|
||||||
(axisθ > 270 && (rot < 90 || axisθ - 180 < rot < 270 || rot > axisθ)) ? -1 : 1
|
(axisθ > 270 && (rot < 90 || axisθ - 180 < rot < 270 || rot > axisθ)) ? -1 : 1
|
||||||
end
|
end
|
||||||
|
|
||||||
if (axisθ - 90) % 180 != 0 || (rot - 90) % 180 != 0
|
if (axisθ - 90) % 180 != 0 || (rot - 90) % 180 != 0
|
||||||
sgn2b = axisθ == 0 ||
|
sgn2b =
|
||||||
(axisθ == 90 && (90 ≤ rot < 180 || 270 ≤ rot < 360)) ||
|
axisθ == 0 ||
|
||||||
(axisθ == 270 && (rot < 90 || 180 ≤ rot < 270)) ||
|
(axisθ == 90 && (90 ≤ rot < 180 || 270 ≤ rot < 360)) ||
|
||||||
(axisθ < 90 && (axisθ < rot < 180 || axisθ + 180 < rot)) ||
|
(axisθ == 270 && (rot < 90 || 180 ≤ rot < 270)) ||
|
||||||
(axisθ > 270 && (rot < axisθ - 180 || 180 ≤ rot < axisθ)) ? -1 : 1
|
(axisθ < 90 && (axisθ < rot < 180 || axisθ + 180 < rot)) ||
|
||||||
|
(axisθ > 270 && (rot < axisθ - 180 || 180 ≤ rot < axisθ)) ? -1 : 1
|
||||||
end
|
end
|
||||||
|
|
||||||
if !(axisθ == 0 && rot % 180 == 0) && ((rot - 90) % 180 != 0)
|
if !(axisθ == 0 && rot % 180 == 0) && ((rot - 90) % 180 != 0)
|
||||||
sgn3 = (axisθ == 0 && 90 < rot < 270) ||
|
sgn3 =
|
||||||
(axisθ == 90 && rot < 180) ||
|
(axisθ == 0 && 90 < rot < 270) ||
|
||||||
(axisθ == 270 && rot > 180) ||
|
(axisθ == 90 && rot < 180) ||
|
||||||
(axisθ < 90 && (rot < axisθ || 90 ≤ rot < 180 || axisθ + 180 < rot < 270)) ||
|
(axisθ == 270 && rot > 180) ||
|
||||||
(axisθ > 270 && (90 ≤ rot < axisθ - 180 || 180 ≤ rot < 270 || rot > axisθ)) ? -1 : 1
|
(axisθ < 90 && (rot < axisθ || 90 ≤ rot < 180 || axisθ + 180 < rot < 270)) ||
|
||||||
|
(axisθ > 270 && (90 ≤ rot < axisθ - 180 || 180 ≤ rot < 270 || rot > axisθ)) ?
|
||||||
|
-1 : 1
|
||||||
end
|
end
|
||||||
|
|
||||||
for (cv, dv) in zip((cvs, dvs)...)
|
for (cv, dv) in zip((cvs, dvs)...)
|
||||||
xi, yi = gr_w3tondc(sort_3d_axes(cv, nt, ft, letter)...)
|
xi, yi = gr_w3tondc(sort_3d_axes(cv, nt, ft, letter)...)
|
||||||
sz_rot = gr_text_size(dv, rot)
|
sz_rot = gr_text_size(dv, rot)
|
||||||
sz = gr_text_size(dv)
|
sz = gr_text_size(dv)
|
||||||
x_offset = x_base_offset + sgn2a * first(sz_rot) / 2 + sgn3 * last(sz) * sind(rot) / 2
|
x_offset =
|
||||||
y_offset = y_base_offset + sgn2b * last(sz_rot) / 2 + sgn3 * last(sz) * cosd(rot) / 2
|
x_base_offset + sgn2a * first(sz_rot) / 2 + sgn3 * last(sz) * sind(rot) / 2
|
||||||
|
y_offset =
|
||||||
|
y_base_offset + sgn2b * last(sz_rot) / 2 + sgn3 * last(sz) * cosd(rot) / 2
|
||||||
gr_text(xi + sgn * x_offset, yi + sgn * y_offset, dv)
|
gr_text(xi + sgn * x_offset, yi + sgn * y_offset, dv)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -2136,4 +2141,3 @@ function _display(plt::Plot{GRBackend})
|
|||||||
end
|
end
|
||||||
|
|
||||||
closeall(::GRBackend) = GR.emergencyclosegks()
|
closeall(::GRBackend) = GR.emergencyclosegks()
|
||||||
|
|
||||||
|
|||||||
@ -969,21 +969,20 @@ function pgfx_font(fontsize::Nothing, thickness_scaling = 1, font = "\\selectfon
|
|||||||
end
|
end
|
||||||
|
|
||||||
function pgfx_should_add_to_legend(series::Series)
|
function pgfx_should_add_to_legend(series::Series)
|
||||||
series.plotattributes[:primary] &&
|
series.plotattributes[:primary] && !(
|
||||||
!(
|
series.plotattributes[:seriestype] in (
|
||||||
series.plotattributes[:seriestype] in (
|
:hexbin,
|
||||||
:hexbin,
|
:bins2d,
|
||||||
:bins2d,
|
:histogram2d,
|
||||||
:histogram2d,
|
:hline,
|
||||||
:hline,
|
:vline,
|
||||||
:vline,
|
:contour,
|
||||||
:contour,
|
:contourf,
|
||||||
:contourf,
|
:contour3d,
|
||||||
:contour3d,
|
:heatmap,
|
||||||
:heatmap,
|
:image,
|
||||||
:image,
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
function pgfx_marker(plotattributes, i = 1)
|
function pgfx_marker(plotattributes, i = 1)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user