commit
008b61c9f6
@ -5,6 +5,9 @@
|
|||||||
supportedArgs(::GRBackend) = [
|
supportedArgs(::GRBackend) = [
|
||||||
:annotation,
|
:annotation,
|
||||||
:background_color, :foreground_color, :color_palette,
|
:background_color, :foreground_color, :color_palette,
|
||||||
|
:background_color_legend, :background_color_inside, :background_color_outside,
|
||||||
|
:foreground_color_legend, :foreground_color_grid, :foreground_color_axis,
|
||||||
|
:foreground_color_text, :foreground_color_border,
|
||||||
:group,
|
:group,
|
||||||
:label,
|
:label,
|
||||||
:linetype,
|
:linetype,
|
||||||
@ -30,6 +33,7 @@ supportedArgs(::GRBackend) = [
|
|||||||
:orientation,
|
:orientation,
|
||||||
:overwrite_figure,
|
:overwrite_figure,
|
||||||
:polar,
|
:polar,
|
||||||
|
:aspect_ratio
|
||||||
]
|
]
|
||||||
supportedAxes(::GRBackend) = _allAxes
|
supportedAxes(::GRBackend) = _allAxes
|
||||||
supportedTypes(::GRBackend) = [:none, :line, :path, :steppre, :steppost, :sticks,
|
supportedTypes(::GRBackend) = [:none, :line, :path, :steppre, :steppost, :sticks,
|
||||||
@ -85,7 +89,7 @@ function gr_getaxisind(p)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function gr_setmarkershape(p)
|
function gr_setmarkershape(p)
|
||||||
if haskey(p, :markershape)
|
if p[:markershape] != :none
|
||||||
shape = p[:markershape]
|
shape = p[:markershape]
|
||||||
if isa(shape, Shape)
|
if isa(shape, Shape)
|
||||||
p[:vertices] = vertices(shape)
|
p[:vertices] = vertices(shape)
|
||||||
@ -135,6 +139,7 @@ end
|
|||||||
|
|
||||||
function gr_polaraxes(rmin, rmax)
|
function gr_polaraxes(rmin, rmax)
|
||||||
GR.savestate()
|
GR.savestate()
|
||||||
|
GR.setlinetype(GR.LINETYPE_SOLID)
|
||||||
GR.setlinecolorind(88)
|
GR.setlinecolorind(88)
|
||||||
tick = 0.5 * GR.tick(rmin, rmax)
|
tick = 0.5 * GR.tick(rmin, rmax)
|
||||||
n = round(Int, (rmax - rmin) / tick + 0.5)
|
n = round(Int, (rmax - rmin) / tick + 0.5)
|
||||||
@ -147,9 +152,10 @@ function gr_polaraxes(rmin, rmax)
|
|||||||
end
|
end
|
||||||
GR.settextalign(GR.TEXT_HALIGN_LEFT, GR.TEXT_VALIGN_HALF)
|
GR.settextalign(GR.TEXT_HALIGN_LEFT, GR.TEXT_VALIGN_HALF)
|
||||||
x, y = GR.wctondc(0.05, r)
|
x, y = GR.wctondc(0.05, r)
|
||||||
GR.text(x, y, @sprintf("%g", rmin + i * tick))
|
GR.text(x, y, string(signif(rmin + i * tick, 12)))
|
||||||
else
|
else
|
||||||
GR.setlinecolorind(90)
|
GR.setlinecolorind(90)
|
||||||
|
GR.drawarc(-r, r, -r, r, 0, 359)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
for alpha in 0:45:315
|
for alpha in 0:45:315
|
||||||
@ -164,6 +170,23 @@ function gr_polaraxes(rmin, rmax)
|
|||||||
GR.restorestate()
|
GR.restorestate()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function gr_getzlims(d, zmin, zmax, adjust)
|
||||||
|
if d[:zlims] != :auto
|
||||||
|
zlims = d[:zlims]
|
||||||
|
if zlims[1] != NaN
|
||||||
|
zmin = zlims[1]
|
||||||
|
end
|
||||||
|
if zlims[2] != NaN
|
||||||
|
zmax = zlims[2]
|
||||||
|
end
|
||||||
|
adjust = false
|
||||||
|
end
|
||||||
|
if adjust
|
||||||
|
zmin, zmax = GR.adjustrange(zmin, zmax)
|
||||||
|
end
|
||||||
|
zmin, zmax
|
||||||
|
end
|
||||||
|
|
||||||
function gr_display(plt::Plot{GRBackend}, clear=true, update=true,
|
function gr_display(plt::Plot{GRBackend}, clear=true, update=true,
|
||||||
subplot=[0, 1, 0, 1])
|
subplot=[0, 1, 0, 1])
|
||||||
d = plt.plotargs
|
d = plt.plotargs
|
||||||
@ -197,23 +220,18 @@ function gr_display(plt::Plot{GRBackend}, clear=true, update=true,
|
|||||||
end
|
end
|
||||||
viewport[4] = vp[3] + 0.95 * (vp[4] - vp[3])
|
viewport[4] = vp[3] + 0.95 * (vp[4] - vp[3])
|
||||||
|
|
||||||
if haskey(d, :background_color)
|
bg = gr_getcolorind(d[:background_color]) # TODO: background for all subplots?
|
||||||
GR.savestate()
|
fg = gr_getcolorind(d[:foreground_color])
|
||||||
GR.selntran(0)
|
|
||||||
GR.setfillintstyle(GR.INTSTYLE_SOLID)
|
GR.savestate()
|
||||||
GR.setfillcolorind(gr_getcolorind(d[:background_color]))
|
GR.selntran(0)
|
||||||
GR.fillrect(vp[1], vp[2], vp[3], vp[4])
|
GR.setfillintstyle(GR.INTSTYLE_SOLID)
|
||||||
GR.selntran(1)
|
GR.setfillcolorind(gr_getcolorind(d[:background_color_outside]))
|
||||||
GR.restorestate()
|
GR.fillrect(vp[1], vp[2], vp[3], vp[4])
|
||||||
c = getColor(d[:background_color])
|
GR.setfillcolorind(gr_getcolorind(d[:background_color_inside]))
|
||||||
if 0.21 * c.r + 0.72 * c.g + 0.07 * c.b < 0.9
|
GR.fillrect(viewport[1], viewport[2], viewport[3], viewport[4])
|
||||||
fg = convert(Int, GR.inqcolorfromrgb(1-c.r, 1-c.g, 1-c.b))
|
GR.selntran(1)
|
||||||
else
|
GR.restorestate()
|
||||||
fg = 1
|
|
||||||
end
|
|
||||||
else
|
|
||||||
fg = 1
|
|
||||||
end
|
|
||||||
|
|
||||||
extrema = zeros(2, 4)
|
extrema = zeros(2, 4)
|
||||||
num_axes = 1
|
num_axes = 1
|
||||||
@ -239,7 +257,7 @@ function gr_display(plt::Plot{GRBackend}, clear=true, update=true,
|
|||||||
elseif lt == :ohlc
|
elseif lt == :ohlc
|
||||||
x, y = 1:size(p[:y], 1), p[:y]
|
x, y = 1:size(p[:y], 1), p[:y]
|
||||||
elseif lt in [:hist, :density]
|
elseif lt in [:hist, :density]
|
||||||
x, y = Base.hist(p[:y])
|
x, y = Base.hist(p[:y], p[:bins])
|
||||||
elseif lt in [:hist2d, :hexbin]
|
elseif lt in [:hist2d, :hexbin]
|
||||||
E = zeros(length(p[:x]),2)
|
E = zeros(length(p[:x]),2)
|
||||||
E[:,1] = p[:x]
|
E[:,1] = p[:x]
|
||||||
@ -348,7 +366,7 @@ function gr_display(plt::Plot{GRBackend}, clear=true, update=true,
|
|||||||
|
|
||||||
if axes_2d
|
if axes_2d
|
||||||
GR.setlinewidth(1)
|
GR.setlinewidth(1)
|
||||||
GR.setlinecolorind(fg)
|
GR.setlinecolorind(gr_getcolorind(d[:foreground_color_grid]))
|
||||||
ticksize = 0.0075 * diag
|
ticksize = 0.0075 * diag
|
||||||
if outside_ticks
|
if outside_ticks
|
||||||
ticksize = -ticksize
|
ticksize = -ticksize
|
||||||
@ -356,6 +374,7 @@ function gr_display(plt::Plot{GRBackend}, clear=true, update=true,
|
|||||||
if grid_flag && fg == 1
|
if grid_flag && fg == 1
|
||||||
GR.grid(xtick, ytick, 0, 0, majorx, majory)
|
GR.grid(xtick, ytick, 0, 0, majorx, majory)
|
||||||
end
|
end
|
||||||
|
GR.setlinecolorind(gr_getcolorind(d[:foreground_color_axis]))
|
||||||
if num_axes == 1
|
if num_axes == 1
|
||||||
GR.axes(xtick, ytick, xorg[1], yorg[1], majorx, majory, ticksize)
|
GR.axes(xtick, ytick, xorg[1], yorg[1], majorx, majory, ticksize)
|
||||||
GR.axes(xtick, ytick, xorg[2], yorg[2], -majorx, -majory, -ticksize)
|
GR.axes(xtick, ytick, xorg[2], yorg[2], -majorx, -majory, -ticksize)
|
||||||
@ -398,10 +417,23 @@ function gr_display(plt::Plot{GRBackend}, clear=true, update=true,
|
|||||||
GR.restorestate()
|
GR.restorestate()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
GR.setcolormap(1000 + GR.COLORMAP_COOLWARM)
|
||||||
|
|
||||||
legend = false
|
legend = false
|
||||||
|
|
||||||
for p in plt.seriesargs
|
for p in plt.seriesargs
|
||||||
lt = p[:linetype]
|
lt = p[:linetype]
|
||||||
|
if lt in (:hist2d, :hexbin, :contour, :surface, :wireframe, :heatmap)
|
||||||
|
if isa(p[:fillcolor], ColorGradient)
|
||||||
|
grad = p[:fillcolor]
|
||||||
|
else
|
||||||
|
grad = default_gradient()
|
||||||
|
end
|
||||||
|
cs = [getColorZ(grad, z) for z in linspace(0, 1, 256)]
|
||||||
|
for (i, c) in enumerate(cs)
|
||||||
|
GR.setcolorrep(999+i, red(c), green(c), blue(c))
|
||||||
|
end
|
||||||
|
end
|
||||||
if get(d, :polar, false)
|
if get(d, :polar, false)
|
||||||
lt = :polar
|
lt = :polar
|
||||||
end
|
end
|
||||||
@ -409,17 +441,15 @@ function gr_display(plt::Plot{GRBackend}, clear=true, update=true,
|
|||||||
xmin, xmax, ymin, ymax = extrema[gr_getaxisind(p),:]
|
xmin, xmax, ymin, ymax = extrema[gr_getaxisind(p),:]
|
||||||
GR.setwindow(xmin, xmax, ymin, ymax)
|
GR.setwindow(xmin, xmax, ymin, ymax)
|
||||||
if lt in [:path, :line, :steppre, :steppost, :sticks, :hline, :vline, :ohlc, :polar]
|
if lt in [:path, :line, :steppre, :steppost, :sticks, :hline, :vline, :ohlc, :polar]
|
||||||
haskey(p, :linestyle) && GR.setlinetype(gr_linetype[p[:linestyle]])
|
GR.setlinetype(gr_linetype[p[:linestyle]])
|
||||||
haskey(p, :linewidth) && GR.setlinewidth(p[:linewidth])
|
GR.setlinewidth(p[:linewidth])
|
||||||
haskey(p, :linecolor) && GR.setlinecolorind(gr_getcolorind(p[:linecolor]))
|
GR.setlinecolorind(gr_getcolorind(p[:linecolor]))
|
||||||
end
|
end
|
||||||
if lt == :path
|
if lt == :path
|
||||||
if haskey(p, :fillcolor)
|
|
||||||
GR.setfillcolorind(gr_getcolorind(p[:fillcolor]))
|
|
||||||
GR.setfillintstyle(GR.INTSTYLE_SOLID)
|
|
||||||
end
|
|
||||||
if length(p[:x]) > 1
|
if length(p[:x]) > 1
|
||||||
if p[:fillrange] != nothing
|
if p[:fillrange] != nothing
|
||||||
|
GR.setfillcolorind(gr_getcolorind(p[:fillcolor]))
|
||||||
|
GR.setfillintstyle(GR.INTSTYLE_SOLID)
|
||||||
GR.fillarea([p[:x][1]; p[:x]; p[:x][length(p[:x])]], [p[:fillrange]; p[:y]; p[:fillrange]])
|
GR.fillarea([p[:x][1]; p[:x]; p[:x][length(p[:x])]], [p[:fillrange]; p[:y]; p[:fillrange]])
|
||||||
end
|
end
|
||||||
GR.polyline(p[:x], p[:y])
|
GR.polyline(p[:x], p[:y])
|
||||||
@ -458,30 +488,24 @@ function gr_display(plt::Plot{GRBackend}, clear=true, update=true,
|
|||||||
end
|
end
|
||||||
legend = true
|
legend = true
|
||||||
elseif lt == :scatter || (p[:markershape] != :none && axes_2d)
|
elseif lt == :scatter || (p[:markershape] != :none && axes_2d)
|
||||||
haskey(p, :markercolor) && GR.setmarkercolorind(gr_getcolorind(p[:markercolor]))
|
GR.setmarkercolorind(gr_getcolorind(p[:markercolor]))
|
||||||
gr_setmarkershape(p)
|
gr_setmarkershape(p)
|
||||||
if haskey(d, :markersize)
|
if typeof(p[:markersize]) <: Number
|
||||||
if typeof(p[:markersize]) <: Number
|
GR.setmarkersize(p[:markersize] / 4.0)
|
||||||
GR.setmarkersize(p[:markersize] / 4.0)
|
|
||||||
if length(p[:x]) > 0
|
|
||||||
gr_polymarker(p, p[:x], p[:y])
|
|
||||||
end
|
|
||||||
else
|
|
||||||
c = p[:markercolor]
|
|
||||||
GR.setcolormap(-GR.COLORMAP_GLOWING)
|
|
||||||
for i = 1:length(p[:x])
|
|
||||||
if isa(c, ColorGradient) && p[:marker_z] != nothing
|
|
||||||
ci = round(Int, 1000 + p[:marker_z][i] * 255)
|
|
||||||
GR.setmarkercolorind(ci)
|
|
||||||
end
|
|
||||||
GR.setmarkersize(p[:markersize][i] / 4.0)
|
|
||||||
gr_polymarker(p, [p[:x][i]], [p[:y][i]])
|
|
||||||
end
|
|
||||||
end
|
|
||||||
else
|
|
||||||
if length(p[:x]) > 0
|
if length(p[:x]) > 0
|
||||||
gr_polymarker(p, p[:x], p[:y])
|
gr_polymarker(p, p[:x], p[:y])
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
c = p[:markercolor]
|
||||||
|
GR.setcolormap(-GR.COLORMAP_GLOWING)
|
||||||
|
for i = 1:length(p[:x])
|
||||||
|
if isa(c, ColorGradient) && p[:marker_z] != nothing
|
||||||
|
ci = round(Int, 1000 + p[:marker_z][i] * 255)
|
||||||
|
GR.setmarkercolorind(ci)
|
||||||
|
end
|
||||||
|
GR.setmarkersize(p[:markersize][i] / 4.0)
|
||||||
|
gr_polymarker(p, [p[:x][i]], [p[:y][i]])
|
||||||
|
end
|
||||||
end
|
end
|
||||||
legend = true
|
legend = true
|
||||||
elseif lt == :bar
|
elseif lt == :bar
|
||||||
@ -490,18 +514,18 @@ function gr_display(plt::Plot{GRBackend}, clear=true, update=true,
|
|||||||
GR.setfillcolorind(gr_getcolorind(p[:fillcolor]))
|
GR.setfillcolorind(gr_getcolorind(p[:fillcolor]))
|
||||||
GR.setfillintstyle(GR.INTSTYLE_SOLID)
|
GR.setfillintstyle(GR.INTSTYLE_SOLID)
|
||||||
GR.fillrect(i-0.4, i+0.4, max(0, ymin), y[i])
|
GR.fillrect(i-0.4, i+0.4, max(0, ymin), y[i])
|
||||||
GR.setfillcolorind(1)
|
GR.setfillcolorind(fg)
|
||||||
GR.setfillintstyle(GR.INTSTYLE_HOLLOW)
|
GR.setfillintstyle(GR.INTSTYLE_HOLLOW)
|
||||||
GR.fillrect(i-0.4, i+0.4, max(0, ymin), y[i])
|
GR.fillrect(i-0.4, i+0.4, max(0, ymin), y[i])
|
||||||
end
|
end
|
||||||
elseif lt in [:hist, :density]
|
elseif lt in [:hist, :density]
|
||||||
h = Base.hist(p[:y])
|
h = Base.hist(p[:y], p[:bins])
|
||||||
x, y = float(collect(h[1])), float(h[2])
|
x, y = float(collect(h[1])), float(h[2])
|
||||||
for i = 2:length(y)
|
for i = 2:length(y)
|
||||||
GR.setfillcolorind(gr_getcolorind(p[:fillcolor]))
|
GR.setfillcolorind(gr_getcolorind(p[:fillcolor]))
|
||||||
GR.setfillintstyle(GR.INTSTYLE_SOLID)
|
GR.setfillintstyle(GR.INTSTYLE_SOLID)
|
||||||
GR.fillrect(x[i-1], x[i], ymin, y[i])
|
GR.fillrect(x[i-1], x[i], ymin, y[i])
|
||||||
GR.setfillcolorind(1)
|
GR.setfillcolorind(fg)
|
||||||
GR.setfillintstyle(GR.INTSTYLE_HOLLOW)
|
GR.setfillintstyle(GR.INTSTYLE_HOLLOW)
|
||||||
GR.fillrect(x[i-1], x[i], ymin, y[i])
|
GR.fillrect(x[i-1], x[i], ymin, y[i])
|
||||||
end
|
end
|
||||||
@ -525,25 +549,24 @@ function gr_display(plt::Plot{GRBackend}, clear=true, update=true,
|
|||||||
x, y, H = Base.hist2d(E, xbins, ybins)
|
x, y, H = Base.hist2d(E, xbins, ybins)
|
||||||
counts = round(Int32, 1000 + 255 * H / maximum(H))
|
counts = round(Int32, 1000 + 255 * H / maximum(H))
|
||||||
n, m = size(counts)
|
n, m = size(counts)
|
||||||
GR.setcolormap(GR.COLORMAP_COOLWARM)
|
|
||||||
GR.cellarray(xmin, xmax, ymin, ymax, n, m, counts)
|
GR.cellarray(xmin, xmax, ymin, ymax, n, m, counts)
|
||||||
GR.setviewport(viewport[2] + 0.02, viewport[2] + 0.05,
|
GR.setviewport(viewport[2] + 0.02, viewport[2] + 0.05,
|
||||||
viewport[3], viewport[4])
|
viewport[3], viewport[4])
|
||||||
GR.setspace(0, maximum(counts), 0, 90)
|
zmin, zmax = gr_getzlims(d, 0, maximum(counts), false)
|
||||||
|
GR.setspace(zmin, zmax, 0, 90)
|
||||||
diag = sqrt((viewport[2] - viewport[1])^2 + (viewport[4] - viewport[3])^2)
|
diag = sqrt((viewport[2] - viewport[1])^2 + (viewport[4] - viewport[3])^2)
|
||||||
charheight = max(0.016 * diag, 0.01)
|
charheight = max(0.016 * diag, 0.01)
|
||||||
GR.setcharheight(charheight)
|
GR.setcharheight(charheight)
|
||||||
GR.colormap()
|
GR.colormap()
|
||||||
elseif lt == :contour
|
elseif lt == :contour
|
||||||
x, y, z = p[:x], p[:y], transpose_z(p, p[:z].surf, false)
|
x, y, z = p[:x], p[:y], transpose_z(p, p[:z].surf, false)
|
||||||
zmin, zmax = minimum(z), maximum(z)
|
zmin, zmax = gr_getzlims(d, minimum(z), maximum(z), false)
|
||||||
|
GR.setspace(zmin, zmax, 0, 90)
|
||||||
if typeof(p[:levels]) <: Array
|
if typeof(p[:levels]) <: Array
|
||||||
h = p[:levels]
|
h = p[:levels]
|
||||||
else
|
else
|
||||||
h = linspace(zmin, zmax, p[:levels])
|
h = linspace(zmin, zmax, p[:levels])
|
||||||
end
|
end
|
||||||
GR.setspace(zmin, zmax, 0, 90)
|
|
||||||
GR.setcolormap(GR.COLORMAP_COOLWARM)
|
|
||||||
GR.contour(x, y, h, reshape(z, length(x) * length(y)), 1000)
|
GR.contour(x, y, h, reshape(z, length(x) * length(y)), 1000)
|
||||||
GR.setviewport(viewport[2] + 0.02, viewport[2] + 0.05,
|
GR.setviewport(viewport[2] + 0.02, viewport[2] + 0.05,
|
||||||
viewport[3], viewport[4])
|
viewport[3], viewport[4])
|
||||||
@ -557,7 +580,7 @@ function gr_display(plt::Plot{GRBackend}, clear=true, update=true,
|
|||||||
GR.axes(0, ztick, xmax, zmin, 0, 1, 0.005)
|
GR.axes(0, ztick, xmax, zmin, 0, 1, 0.005)
|
||||||
elseif lt in [:surface, :wireframe]
|
elseif lt in [:surface, :wireframe]
|
||||||
x, y, z = p[:x], p[:y], transpose_z(p, p[:z].surf, false)
|
x, y, z = p[:x], p[:y], transpose_z(p, p[:z].surf, false)
|
||||||
zmin, zmax = GR.adjustrange(minimum(z), maximum(z))
|
zmin, zmax = gr_getzlims(d, minimum(z), maximum(z), true)
|
||||||
GR.setspace(zmin, zmax, 40, 70)
|
GR.setspace(zmin, zmax, 40, 70)
|
||||||
xtick = GR.tick(xmin, xmax) / 2
|
xtick = GR.tick(xmin, xmax) / 2
|
||||||
ytick = GR.tick(ymin, ymax) / 2
|
ytick = GR.tick(ymin, ymax) / 2
|
||||||
@ -572,7 +595,6 @@ function gr_display(plt::Plot{GRBackend}, clear=true, update=true,
|
|||||||
end
|
end
|
||||||
z = reshape(z, length(x) * length(y))
|
z = reshape(z, length(x) * length(y))
|
||||||
if lt == :surface
|
if lt == :surface
|
||||||
GR.setcolormap(GR.COLORMAP_COOLWARM)
|
|
||||||
GR.gr3.surface(x, y, z, GR.OPTION_COLORED_MESH)
|
GR.gr3.surface(x, y, z, GR.OPTION_COLORED_MESH)
|
||||||
else
|
else
|
||||||
GR.setfillcolorind(0)
|
GR.setfillcolorind(0)
|
||||||
@ -589,9 +611,8 @@ function gr_display(plt::Plot{GRBackend}, clear=true, update=true,
|
|||||||
end
|
end
|
||||||
elseif lt == :heatmap
|
elseif lt == :heatmap
|
||||||
x, y, z = p[:x], p[:y], transpose_z(p, p[:z].surf, false)
|
x, y, z = p[:x], p[:y], transpose_z(p, p[:z].surf, false)
|
||||||
zmin, zmax = GR.adjustrange(minimum(z), maximum(z))
|
zmin, zmax = gr_getzlims(d, minimum(z), maximum(z), true)
|
||||||
GR.setspace(zmin, zmax, 0, 90)
|
GR.setspace(zmin, zmax, 0, 90)
|
||||||
GR.setcolormap(GR.COLORMAP_COOLWARM)
|
|
||||||
z = reshape(z, length(x) * length(y))
|
z = reshape(z, length(x) * length(y))
|
||||||
GR.surface(x, y, z, GR.OPTION_CELL_ARRAY)
|
GR.surface(x, y, z, GR.OPTION_CELL_ARRAY)
|
||||||
if cmap
|
if cmap
|
||||||
@ -601,7 +622,7 @@ function gr_display(plt::Plot{GRBackend}, clear=true, update=true,
|
|||||||
end
|
end
|
||||||
elseif lt in [:path3d, :scatter3d]
|
elseif lt in [:path3d, :scatter3d]
|
||||||
x, y, z = p[:x], p[:y], p[:z]
|
x, y, z = p[:x], p[:y], p[:z]
|
||||||
zmin, zmax = GR.adjustrange(minimum(z), maximum(z))
|
zmin, zmax = gr_getzlims(d, minimum(z), maximum(z), true)
|
||||||
GR.setspace(zmin, zmax, 40, 70)
|
GR.setspace(zmin, zmax, 40, 70)
|
||||||
xtick = GR.tick(xmin, xmax) / 2
|
xtick = GR.tick(xmin, xmax) / 2
|
||||||
ytick = GR.tick(ymin, ymax) / 2
|
ytick = GR.tick(ymin, ymax) / 2
|
||||||
@ -615,15 +636,15 @@ function gr_display(plt::Plot{GRBackend}, clear=true, update=true,
|
|||||||
GR.grid3d(0, ytick, 0, xmax, ymin, zmin, 0, 2, 0)
|
GR.grid3d(0, ytick, 0, xmax, ymin, zmin, 0, 2, 0)
|
||||||
end
|
end
|
||||||
if lt == :scatter3d
|
if lt == :scatter3d
|
||||||
haskey(p, :markercolor) && GR.setmarkercolorind(gr_getcolorind(p[:markercolor]))
|
GR.setmarkercolorind(gr_getcolorind(p[:markercolor]))
|
||||||
gr_setmarkershape(p)
|
gr_setmarkershape(p)
|
||||||
for i = 1:length(z)
|
for i = 1:length(z)
|
||||||
px, py = GR.wc3towc(x[i], y[i], z[i])
|
px, py = GR.wc3towc(x[i], y[i], z[i])
|
||||||
gr_polymarker(p, [px], [py])
|
gr_polymarker(p, [px], [py])
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
haskey(p, :linewidth) && GR.setlinewidth(p[:linewidth])
|
|
||||||
if length(x) > 0
|
if length(x) > 0
|
||||||
|
GR.setlinewidth(p[:linewidth])
|
||||||
GR.polyline3d(x, y, z)
|
GR.polyline3d(x, y, z)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -695,7 +716,7 @@ function gr_display(plt::Plot{GRBackend}, clear=true, update=true,
|
|||||||
GR.setwindow(-1, 1, -1, 1)
|
GR.setwindow(-1, 1, -1, 1)
|
||||||
rmin, rmax = GR.adjustrange(minimum(r), maximum(r))
|
rmin, rmax = GR.adjustrange(minimum(r), maximum(r))
|
||||||
gr_polaraxes(rmin, rmax)
|
gr_polaraxes(rmin, rmax)
|
||||||
phi, r, = p[:x], p[:y]
|
phi, r = p[:x], p[:y]
|
||||||
r = 0.5 * (r - rmin) / (rmax - rmin)
|
r = 0.5 * (r - rmin) / (rmax - rmin)
|
||||||
n = length(r)
|
n = length(r)
|
||||||
x = zeros(n)
|
x = zeros(n)
|
||||||
@ -729,21 +750,21 @@ function gr_display(plt::Plot{GRBackend}, clear=true, update=true,
|
|||||||
py = viewport[4] - 0.06
|
py = viewport[4] - 0.06
|
||||||
dy = 0.03 * sqrt((viewport[2] - viewport[1])^2 + (viewport[4] - viewport[3])^2)
|
dy = 0.03 * sqrt((viewport[2] - viewport[1])^2 + (viewport[4] - viewport[3])^2)
|
||||||
GR.setfillintstyle(GR.INTSTYLE_SOLID)
|
GR.setfillintstyle(GR.INTSTYLE_SOLID)
|
||||||
GR.setfillcolorind(0)
|
GR.setfillcolorind(gr_getcolorind(d[:background_color_legend]))
|
||||||
GR.fillrect(px - 0.08, px + w + 0.02, py + dy, py - dy * length(plt.seriesargs))
|
GR.fillrect(px - 0.08, px + w + 0.02, py + dy, py - dy * length(plt.seriesargs))
|
||||||
GR.setlinetype(1)
|
GR.setlinetype(1)
|
||||||
GR.setlinewidth(1)
|
GR.setlinewidth(1)
|
||||||
GR.drawrect(px - 0.08, px + w + 0.02, py + dy, py - dy * length(plt.seriesargs))
|
GR.drawrect(px - 0.08, px + w + 0.02, py + dy, py - dy * length(plt.seriesargs))
|
||||||
i = 0
|
i = 0
|
||||||
for p in plt.seriesargs
|
for p in plt.seriesargs
|
||||||
haskey(p, :linewidth) && GR.setlinewidth(p[:linewidth])
|
GR.setlinewidth(p[:linewidth])
|
||||||
if p[:linetype] in [:path, :line, :steppre, :steppost, :sticks]
|
if p[:linetype] in [:path, :line, :steppre, :steppost, :sticks]
|
||||||
haskey(p, :linecolor) && GR.setlinecolorind(gr_getcolorind(p[:linecolor]))
|
GR.setlinecolorind(gr_getcolorind(p[:linecolor]))
|
||||||
haskey(p, :linestyle) && GR.setlinetype(gr_linetype[p[:linestyle]])
|
GR.setlinetype(gr_linetype[p[:linestyle]])
|
||||||
GR.polyline([px - 0.07, px - 0.01], [py, py])
|
GR.polyline([px - 0.07, px - 0.01], [py, py])
|
||||||
end
|
end
|
||||||
if p[:linetype] == :scatter || p[:markershape] != :none
|
if p[:linetype] == :scatter || p[:markershape] != :none
|
||||||
haskey(p, :markercolor) && GR.setmarkercolorind(gr_getcolorind(p[:markercolor]))
|
GR.setmarkercolorind(gr_getcolorind(p[:markercolor]))
|
||||||
gr_setmarkershape(p)
|
gr_setmarkershape(p)
|
||||||
if p[:linetype] in [:path, :line, :steppre, :steppost, :sticks]
|
if p[:linetype] in [:path, :line, :steppre, :steppost, :sticks]
|
||||||
gr_polymarker(p, [px - 0.06, px - 0.02], [py, py])
|
gr_polymarker(p, [px - 0.06, px - 0.02], [py, py])
|
||||||
@ -758,7 +779,7 @@ function gr_display(plt::Plot{GRBackend}, clear=true, update=true,
|
|||||||
lab = p[:label]
|
lab = p[:label]
|
||||||
end
|
end
|
||||||
GR.settextalign(GR.TEXT_HALIGN_LEFT, GR.TEXT_VALIGN_HALF)
|
GR.settextalign(GR.TEXT_HALIGN_LEFT, GR.TEXT_VALIGN_HALF)
|
||||||
GR.settextcolorind(1)
|
GR.settextcolorind(gr_getcolorind(d[:foreground_color_legend]))
|
||||||
GR.text(px, py, lab)
|
GR.text(px, py, lab)
|
||||||
py -= dy
|
py -= dy
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user