Added more line plots
This commit is contained in:
parent
da9fdb356c
commit
2e8dd73822
@ -135,20 +135,46 @@ function gr_display(plt::Plot{GRPackage})
|
|||||||
legend = false
|
legend = false
|
||||||
|
|
||||||
for p in plt.seriesargs
|
for p in plt.seriesargs
|
||||||
|
if p[:linetype] in [:path, :line, :steppre, :steppost, :sticks, :hline, :vline]
|
||||||
|
haskey(p, :linecolor) && GR.setlinecolorind(gr_getcolorind(p[:linecolor]))
|
||||||
|
haskey(p, :linestyle) && GR.setlinetype(gr_linetype[p[:linestyle]])
|
||||||
|
end
|
||||||
if p[:linetype] == :path
|
if p[:linetype] == :path
|
||||||
if haskey(p, :fillcolor)
|
if haskey(p, :fillcolor)
|
||||||
GR.setfillcolorind(gr_getcolorind(p[:fillcolor]))
|
GR.setfillcolorind(gr_getcolorind(p[:fillcolor]))
|
||||||
GR.setfillintstyle(GR.INTSTYLE_SOLID)
|
GR.setfillintstyle(GR.INTSTYLE_SOLID)
|
||||||
end
|
end
|
||||||
haskey(p, :linecolor) && GR.setlinecolorind(gr_getcolorind(p[:linecolor]))
|
|
||||||
haskey(p, :linestyle) && GR.setlinetype(gr_linetype[p[:linestyle]])
|
|
||||||
if p[:fillrange] != nothing
|
if p[:fillrange] != nothing
|
||||||
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])
|
||||||
legend = true
|
legend = true
|
||||||
end
|
end
|
||||||
if p[:linetype] == :scatter || p[:markershape] != :none
|
if p[:linetype] == :line
|
||||||
|
GR.polyline(p[:x], p[:y])
|
||||||
|
legend = true
|
||||||
|
elseif p[:linetype] in [:steppre, :steppost]
|
||||||
|
x = [p[:x][1]]
|
||||||
|
y = [p[:y][1]]
|
||||||
|
n = length(p[:x])
|
||||||
|
for i = 2:n
|
||||||
|
if p[:linetype] == :steppre
|
||||||
|
x = [x; p[:x][i-1]; p[:x][i]]
|
||||||
|
y = [y; p[:y][i]; p[:y][i]]
|
||||||
|
else
|
||||||
|
x = [x; p[:x][i]; p[:x][i]]
|
||||||
|
y = [y; p[:y][i-1]; p[:y][i]]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
GR.polyline(x, y)
|
||||||
|
legend = true
|
||||||
|
elseif p[:linetype] == :sticks
|
||||||
|
x, y = p[:x], p[:y]
|
||||||
|
for i = 1:length(y)
|
||||||
|
GR.polyline([x[i], x[i]], [ymin, y[i]])
|
||||||
|
end
|
||||||
|
legend = true
|
||||||
|
elseif p[:linetype] == :scatter || p[:markershape] != :none
|
||||||
haskey(p, :markercolor) && GR.setmarkercolorind(gr_getcolorind(p[:markercolor]))
|
haskey(p, :markercolor) && GR.setmarkercolorind(gr_getcolorind(p[:markercolor]))
|
||||||
haskey(p, :markershape) && GR.setmarkertype(gr_markertype[p[:markershape]])
|
haskey(p, :markershape) && GR.setmarkertype(gr_markertype[p[:markershape]])
|
||||||
if haskey(d, :markersize)
|
if haskey(d, :markersize)
|
||||||
@ -193,8 +219,6 @@ function gr_display(plt::Plot{GRPackage})
|
|||||||
GR.fillrect(x[i-1], x[i], ymin, y[i])
|
GR.fillrect(x[i-1], x[i], ymin, y[i])
|
||||||
end
|
end
|
||||||
elseif p[:linetype] in [:hline, :vline]
|
elseif p[:linetype] in [:hline, :vline]
|
||||||
haskey(p, :linecolor) && GR.setlinecolorind(gr_getcolorind(p[:linecolor]))
|
|
||||||
haskey(p, :linestyle) && GR.setlinetype(gr_linetype[p[:linestyle]])
|
|
||||||
for xy in p[:y]
|
for xy in p[:y]
|
||||||
if p[:linetype] == :hline
|
if p[:linetype] == :hline
|
||||||
GR.polyline([xmin, xmax], [xy, xy])
|
GR.polyline([xmin, xmax], [xy, xy])
|
||||||
@ -202,8 +226,7 @@ function gr_display(plt::Plot{GRPackage})
|
|||||||
GR.polyline([xy, xy], [ymin, ymax])
|
GR.polyline([xy, xy], [ymin, ymax])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
elseif p[:linetype] in [:line, :steppre, :steppost, :sticks,
|
elseif p[:linetype] in [:heatmap, :hexbin, :density,
|
||||||
:heatmap, :hexbin, :density,
|
|
||||||
:contour, :path3d, :scatter3d, :surface,
|
:contour, :path3d, :scatter3d, :surface,
|
||||||
:wireframe, :ohlc, :pie]
|
:wireframe, :ohlc, :pie]
|
||||||
println("TODO: add support for linetype $(p[:linetype])")
|
println("TODO: add support for linetype $(p[:linetype])")
|
||||||
@ -237,7 +260,7 @@ function gr_display(plt::Plot{GRPackage})
|
|||||||
haskey(d, :linewidth) && GR.setlinewidth(d[:linewidth])
|
haskey(d, :linewidth) && GR.setlinewidth(d[:linewidth])
|
||||||
i = 0
|
i = 0
|
||||||
for p in plt.seriesargs
|
for p in plt.seriesargs
|
||||||
if p[:linetype] == :path
|
if p[:linetype] in [:path, :line, :steppre, :steppost, :sticks]
|
||||||
haskey(p, :linecolor) && GR.setlinecolorind(gr_getcolorind(p[:linecolor]))
|
haskey(p, :linecolor) && GR.setlinecolorind(gr_getcolorind(p[:linecolor]))
|
||||||
haskey(p, :linestyle) && GR.setlinetype(gr_linetype[p[:linestyle]])
|
haskey(p, :linestyle) && GR.setlinetype(gr_linetype[p[:linestyle]])
|
||||||
GR.polyline([px - 0.05, px - 0.01], [py, py])
|
GR.polyline([px - 0.05, px - 0.01], [py, py])
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user