Added some sanity checks
This commit is contained in:
parent
55d7e910e4
commit
c5fb4a9228
@ -121,6 +121,12 @@ function gr_display(plt::Plot{GRPackage}, clear=true, update=true,
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
if xmax <= xmin
|
||||||
|
xmax = xmin + 1
|
||||||
|
end
|
||||||
|
if ymax <= ymin
|
||||||
|
ymax = ymin + 1
|
||||||
|
end
|
||||||
extrema[axis,:] = [xmin, xmax, ymin, ymax]
|
extrema[axis,:] = [xmin, xmax, ymin, ymax]
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -236,14 +242,18 @@ function gr_display(plt::Plot{GRPackage}, 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)
|
||||||
end
|
end
|
||||||
if p[:fillrange] != nothing
|
if length(p[:x]) > 1
|
||||||
GR.fillarea([p[:x][1]; p[:x]; p[:x][length(p[:x])]], [p[:fillrange]; p[:y]; p[:fillrange]])
|
if p[:fillrange] != nothing
|
||||||
|
GR.fillarea([p[:x][1]; p[:x]; p[:x][length(p[:x])]], [p[:fillrange]; p[:y]; p[:fillrange]])
|
||||||
|
end
|
||||||
|
GR.polyline(p[:x], p[:y])
|
||||||
end
|
end
|
||||||
GR.polyline(p[:x], p[:y])
|
|
||||||
legend = true
|
legend = true
|
||||||
end
|
end
|
||||||
if p[:linetype] == :line
|
if p[:linetype] == :line
|
||||||
GR.polyline(p[:x], p[:y])
|
if length(p[:x]) > 1
|
||||||
|
GR.polyline(p[:x], p[:y])
|
||||||
|
end
|
||||||
legend = true
|
legend = true
|
||||||
elseif p[:linetype] in [:steppre, :steppost]
|
elseif p[:linetype] in [:steppre, :steppost]
|
||||||
n = length(p[:x])
|
n = length(p[:x])
|
||||||
@ -261,7 +271,9 @@ function gr_display(plt::Plot{GRPackage}, clear=true, update=true,
|
|||||||
end
|
end
|
||||||
j += 2
|
j += 2
|
||||||
end
|
end
|
||||||
GR.polyline(x, y)
|
if n > 1
|
||||||
|
GR.polyline(x, y)
|
||||||
|
end
|
||||||
legend = true
|
legend = true
|
||||||
elseif p[:linetype] == :sticks
|
elseif p[:linetype] == :sticks
|
||||||
x, y = p[:x], p[:y]
|
x, y = p[:x], p[:y]
|
||||||
@ -275,7 +287,9 @@ function gr_display(plt::Plot{GRPackage}, clear=true, update=true,
|
|||||||
if haskey(d, :markersize)
|
if haskey(d, :markersize)
|
||||||
if typeof(d[:markersize]) <: Number
|
if typeof(d[:markersize]) <: Number
|
||||||
GR.setmarkersize(d[:markersize] / 4.0)
|
GR.setmarkersize(d[:markersize] / 4.0)
|
||||||
GR.polymarker(p[:x], p[:y])
|
if length(p[:x]) > 0
|
||||||
|
GR.polymarker(p[:x], p[:y])
|
||||||
|
end
|
||||||
else
|
else
|
||||||
c = p[:markercolor]
|
c = p[:markercolor]
|
||||||
GR.setcolormap(-GR.COLORMAP_GLOWING)
|
GR.setcolormap(-GR.COLORMAP_GLOWING)
|
||||||
@ -289,7 +303,9 @@ function gr_display(plt::Plot{GRPackage}, clear=true, update=true,
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
GR.polymarker(p[:x], p[:y])
|
if length(p[:x]) > 0
|
||||||
|
GR.polymarker(p[:x], p[:y])
|
||||||
|
end
|
||||||
end
|
end
|
||||||
legend = true
|
legend = true
|
||||||
elseif p[:linetype] == :bar
|
elseif p[:linetype] == :bar
|
||||||
@ -419,7 +435,9 @@ function gr_display(plt::Plot{GRPackage}, clear=true, update=true,
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
haskey(p, :linewidth) && GR.setlinewidth(p[:linewidth])
|
haskey(p, :linewidth) && GR.setlinewidth(p[:linewidth])
|
||||||
GR.polyline3d(x, y, z)
|
if length(x) > 0
|
||||||
|
GR.polyline3d(x, y, z)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
GR.setlinewidth(1)
|
GR.setlinewidth(1)
|
||||||
GR.setcharheight(charheight)
|
GR.setcharheight(charheight)
|
||||||
|
|||||||
@ -189,6 +189,7 @@ supportedArgs(::GRPackage) = [
|
|||||||
:label,
|
:label,
|
||||||
:layout,
|
:layout,
|
||||||
:legend,
|
:legend,
|
||||||
|
:colorbar,
|
||||||
:linestyle,
|
:linestyle,
|
||||||
:linetype,
|
:linetype,
|
||||||
:linewidth,
|
:linewidth,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user