Baby steps

This commit is contained in:
Patrick Kofod Mogensen 2016-03-15 16:20:12 +01:00
parent 4d864d8cad
commit 85068d82d9
2 changed files with 18 additions and 6 deletions

View File

@ -85,11 +85,24 @@ end
################# This is the important method to implement!!! #################
function _make_pgf_plot(plt::Plot{PGFPlotsBackend})
line_type = plt.seriesargs[1][:linetype]
if line_type == :path
plt.o = PGFPlots.Linear(plt.seriesargs[1][:x], plt.seriesargs[1][:y])
elseif line_type == :scatter
plt.o = PGFPlots.Scatter(plt.seriesargs[1][:x], plt.seriesargs[1][:y])
elseif line_type == :steppost
plt.o = PGFPlots.Linear(plt.seriesargs[1][:x], plt.seriesargs[1][:y], style="const plot")
elseif line_type == :hist
plt_hist = hist(plt.seriesargs[1][:y])
plt.o = PGFPlots.Linear(plt_hist[1][1:end-1], plt_hist[2], style="ybar,fill=green", mark="none")
elseif line_type == :bar
plt.o = PGFPlots.Linear(plt.seriesargs[1][:x], plt.seriesargs[1][:y], style="ybar,fill=green", mark="none")
end
# TODO: convert plt.plotargs and plt.seriesargs into PGFPlots calls
# TODO: return the PGFPlots object
end
function Base.writemime(io::IO, mime::MIME"image/png", plt::AbstractPlot{PGFPlotsBackend})
function Base.writemime(io::IO, mime::MIME"image/svg+xml", plt::AbstractPlot{PGFPlotsBackend})
plt.o = _make_pgf_plot(plt)
writemime(io, mime, plt.o)
end

View File

@ -723,7 +723,7 @@ supportedArgs(::PGFPlotsBackend) = [
# :legend,
# :linecolor,
# :linestyle,
# :linetype,
:linetype,
# :linewidth,
# :linealpha,
# :markershape,
@ -743,11 +743,11 @@ supportedArgs(::PGFPlotsBackend) = [
# :size,
# :title,
# :windowtitle,
# :x,
:x,
# :xlabel,
# :xlims,
# :xticks,
# :y,
:y,
# :ylabel,
# :ylims,
# :yrightlabel,
@ -765,9 +765,8 @@ supportedArgs(::PGFPlotsBackend) = [
# :levels,
]
supportedAxes(::PGFPlotsBackend) = [:auto, :left]
supportedTypes(::PGFPlotsBackend) = [:contour] #, :path, :scatter ,:steppre, :steppost, :sticks, :hist2d, :hexbin, :hist, :bar, :hline, :vline, :contour]
supportedTypes(::PGFPlotsBackend) = [:path, :scatter, :line, :steppost, :hist, :bar] #, :steppre, :sticks, :hist2d, :hexbin, :bar, :hline, :vline, :contour]
supportedStyles(::PGFPlotsBackend) = [:auto, :solid] #, :dash, :dot, :dashdot, :dashdotdot]
supportedMarkers(::PGFPlotsBackend) = [:none, :auto, :ellipse] #, :rect, :diamond, :utriangle, :dtriangle, :cross, :xcross, :star5] #vcat(_allMarkers, Shape)
supportedScales(::PGFPlotsBackend) = [:identity] #, :log, :log2, :log10, :asinh, :sqrt]
subplotSupported(::PGFPlotsBackend) = false