Added some sanity checks

This commit is contained in:
Josef Heinen 2016-02-09 17:48:45 +01:00
parent 55d7e910e4
commit c5fb4a9228
2 changed files with 27 additions and 8 deletions

View File

@ -121,6 +121,12 @@ function gr_display(plt::Plot{GRPackage}, clear=true, update=true,
end
end
end
if xmax <= xmin
xmax = xmin + 1
end
if ymax <= ymin
ymax = ymin + 1
end
extrema[axis,:] = [xmin, xmax, ymin, ymax]
end
@ -236,14 +242,18 @@ function gr_display(plt::Plot{GRPackage}, clear=true, update=true,
GR.setfillcolorind(gr_getcolorind(p[:fillcolor]))
GR.setfillintstyle(GR.INTSTYLE_SOLID)
end
if length(p[:x]) > 1
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
legend = true
end
if p[:linetype] == :line
if length(p[:x]) > 1
GR.polyline(p[:x], p[:y])
end
legend = true
elseif p[:linetype] in [:steppre, :steppost]
n = length(p[:x])
@ -261,7 +271,9 @@ function gr_display(plt::Plot{GRPackage}, clear=true, update=true,
end
j += 2
end
if n > 1
GR.polyline(x, y)
end
legend = true
elseif p[:linetype] == :sticks
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 typeof(d[:markersize]) <: Number
GR.setmarkersize(d[:markersize] / 4.0)
if length(p[:x]) > 0
GR.polymarker(p[:x], p[:y])
end
else
c = p[:markercolor]
GR.setcolormap(-GR.COLORMAP_GLOWING)
@ -289,8 +303,10 @@ function gr_display(plt::Plot{GRPackage}, clear=true, update=true,
end
end
else
if length(p[:x]) > 0
GR.polymarker(p[:x], p[:y])
end
end
legend = true
elseif p[:linetype] == :bar
y = p[:y]
@ -419,8 +435,10 @@ function gr_display(plt::Plot{GRPackage}, clear=true, update=true,
end
else
haskey(p, :linewidth) && GR.setlinewidth(p[:linewidth])
if length(x) > 0
GR.polyline3d(x, y, z)
end
end
GR.setlinewidth(1)
GR.setcharheight(charheight)
GR.axes3d(xtick, 0, ztick, xmin, ymin, zmin, 2, 0, 2, -ticksize)

View File

@ -189,6 +189,7 @@ supportedArgs(::GRPackage) = [
:label,
:layout,
:legend,
:colorbar,
:linestyle,
:linetype,
:linewidth,