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!!! ################# ################# This is the important method to implement!!! #################
function _make_pgf_plot(plt::Plot{PGFPlotsBackend}) 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: convert plt.plotargs and plt.seriesargs into PGFPlots calls
# TODO: return the PGFPlots object # TODO: return the PGFPlots object
end 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) plt.o = _make_pgf_plot(plt)
writemime(io, mime, plt.o) writemime(io, mime, plt.o)
end end

View File

@ -723,7 +723,7 @@ supportedArgs(::PGFPlotsBackend) = [
# :legend, # :legend,
# :linecolor, # :linecolor,
# :linestyle, # :linestyle,
# :linetype, :linetype,
# :linewidth, # :linewidth,
# :linealpha, # :linealpha,
# :markershape, # :markershape,
@ -743,11 +743,11 @@ supportedArgs(::PGFPlotsBackend) = [
# :size, # :size,
# :title, # :title,
# :windowtitle, # :windowtitle,
# :x, :x,
# :xlabel, # :xlabel,
# :xlims, # :xlims,
# :xticks, # :xticks,
# :y, :y,
# :ylabel, # :ylabel,
# :ylims, # :ylims,
# :yrightlabel, # :yrightlabel,
@ -765,9 +765,8 @@ supportedArgs(::PGFPlotsBackend) = [
# :levels, # :levels,
] ]
supportedAxes(::PGFPlotsBackend) = [:auto, :left] 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] supportedStyles(::PGFPlotsBackend) = [:auto, :solid] #, :dash, :dot, :dashdot, :dashdotdot]
supportedMarkers(::PGFPlotsBackend) = [:none, :auto, :ellipse] #, :rect, :diamond, :utriangle, :dtriangle, :cross, :xcross, :star5] #vcat(_allMarkers, Shape) supportedMarkers(::PGFPlotsBackend) = [:none, :auto, :ellipse] #, :rect, :diamond, :utriangle, :dtriangle, :cross, :xcross, :star5] #vcat(_allMarkers, Shape)
supportedScales(::PGFPlotsBackend) = [:identity] #, :log, :log2, :log10, :asinh, :sqrt] supportedScales(::PGFPlotsBackend) = [:identity] #, :log, :log2, :log10, :asinh, :sqrt]
subplotSupported(::PGFPlotsBackend) = false subplotSupported(::PGFPlotsBackend) = false