pyplot push and nnet

This commit is contained in:
Thomas Breloff 2015-10-25 17:08:42 -04:00
parent ca2b6c87ef
commit 62fad3724f
4 changed files with 95 additions and 141 deletions

File diff suppressed because one or more lines are too long

View File

@ -277,7 +277,12 @@ end
function Base.getindex(plt::Plot{PyPlotPackage}, i::Integer)
series = plt.seriesargs[i][:serieshandle]
series[:get_data]()
try
return series[:get_data]()
catch
xy = series[:get_offsets]()
return vec(xy[:,1]), vec(xy[:,2])
end
# series[:relim]()
# mapping = getGadflyMappings(plt, i)[1]
# mapping[:x], mapping[:y]
@ -285,7 +290,11 @@ end
function Base.setindex!(plt::Plot{PyPlotPackage}, xy::Tuple, i::Integer)
series = plt.seriesargs[i][:serieshandle]
series[:set_data](xy...)
try
series[:set_data](xy...)
catch
series[:set_offsets](hcat(xy...))
end
ax = series[:axes]
if plt.initargs[:xlims] == :auto

View File

@ -111,7 +111,7 @@ function updateLimsAndTicks(plt::Plot{QwtPackage}, d::Dict, isx::Bool)
plt.o.autoscale_y = false
end
w[:setAxisScale](axisid, float(minimum(ticks)), float(maximum(ticks)), float(step(ticks)))
elseif ticks != nothing
elseif !(ticks in (nothing, :none, :auto))
warn("Only Range types are supported for Qwt xticks/yticks. typeof(ticks)=$(typeof(ticks))")
end
@ -241,6 +241,7 @@ end
# ----------------------------------------------------------------
function Base.writemime(io::IO, ::MIME"image/png", plt::Plot{QwtPackage})
Qwt.refresh(plt.o)
Qwt.savepng(plt.o, "/tmp/dfskjdhfkh.png")
write(io, readall("/tmp/dfskjdhfkh.png"))
end

View File

@ -160,6 +160,10 @@ function backend()
# @eval const pycolorbar = PyPlot.pywrap(PyPlot.pyimport("matplotlib.colorbar"))
if !isa(Base.Multimedia.displays[end], Base.REPL.REPLDisplay)
PyPlot.ioff()
# "pyqt4"=>:qt_pyqt4
# PyPlot.backend[1] = "pyqt4"
# PyPlot.gui[1] = :qt_pyqt4
# PyPlot.switch_backend("Qt4Agg")
PyPlot.pygui(true)
end
catch err