{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": { "collapsed": false }, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "INFO: Recompiling stale cache file /home/tom/.julia/lib/v0.4/Plots.ji for module Plots.\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "[Plots.jl] Default backend: immerse\n", "[Plots.jl] Switched to backend: gadfly" ] } ], "source": [ "using Plots\n", "gadfly()\n", "default(leg=false);\n", "#Plots._debugMode.on=true;" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "collapsed": false }, "outputs": [ { "ename": "LoadError", "evalue": "LoadError: UndefVarError: GadflyPackage not defined\nwhile loading In[2], in expression starting on line 2", "output_type": "error", "traceback": [ "LoadError: UndefVarError: GadflyPackage not defined\nwhile loading In[2], in expression starting on line 2", "" ] } ], "source": [ "# link the subplots together to share axes... useful for facet plots, cross-scatters, etc\n", "function linkPlots(subplt::Plots.Subplot{GadflyPackage})\n", "end" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "[Plots.jl] Initializing backend: gadfly" ] } ], "source": [ "y = linspace(0,1,100)\n", "p = subplot(repmat(y,1,4),n=4);" ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "collapsed": false }, "outputs": [ { "ename": "ErrorException", "evalue": "type GridLayout has no field rowcounts", "output_type": "error", "traceback": [ "type GridLayout has no field rowcounts", "", " in buildGadflySubplotContext at /home/tom/.julia/v0.4/Plots/src/backends/gadfly.jl:497", " in writemime at /home/tom/.julia/v0.4/Plots/src/backends/gadfly.jl:523", " in base64encode at base64.jl:160", " in display_dict at /home/tom/.julia/v0.4/IJulia/src/execute_request.jl:32" ] } ], "source": [ "i = 1\n", "subplot!(ylabel=[\"y1\",\"y1\",\"y2\",\"y2\"], xlabel=[\"x1\",\"x2\",\"x1\",\"x2\"])\n", "# findGuideAndSet(gplt, t::DataType, s::@compat(AbstractString))\n", "for (i,(r,c)) in enumerate(p.layout)\n", "# for (r,nc) in enumerate(p.layout.rowcounts)\n", "# for c in 1:nc\n", " gplt = p.plts[i].o\n", " if r < Plots.nrows(p.layout)\n", " push!(gplt.guides, Gadfly.Guide.xticks(label=false))\n", " Plots.findGuideAndSet(gplt, Gadfly.Guide.xlabel, \"\")\n", " end\n", " if c > 1\n", " push!(gplt.guides, Gadfly.Guide.yticks(label=false))\n", " Plots.findGuideAndSet(gplt, Gadfly.Guide.ylabel, \"\")\n", " end\n", "end\n", "#p1 = p.plts[1].o\n", "#push!(p1.guides, Gadfly.Guide.xticks(label=false,ticks=nothing))\n", "p" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "p.layout.rowcounts" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "\n", "immutable FlexLayout \n", " numplts::Int\n", " rowcounts::AbstractVector{Int}\n", "end\n", "\n", "immutable GridLayout \n", " nr::Int\n", " nc::Int\n", "end" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "\n", "\n", "Base.length(layout::FlexLayout) = layout.numplts\n", "Base.start(layout::FlexLayout) = 1\n", "Base.done(layout::FlexLayout, state) = state > length(layout)\n", "function Base.next(layout::FlexLayout, state)\n", " r = 1\n", " c = 0\n", " for i = 1:state\n", " c += 1\n", " if c > layout.rowcounts[r]\n", " r += 1\n", " c = 1\n", " end\n", " end\n", " (r,c), state + 1\n", "end\n", "\n", "\n", "Base.length(layout::GridLayout) = layout.nr * layout.nc\n", "Base.start(layout::GridLayout) = 1\n", "Base.done(layout::GridLayout, state) = state > length(layout)\n", "function Base.next(layout::GridLayout, state)\n", " r = div(state, layout.nc)\n", " c = mod1(state, layout.nc)\n", " (r,c), state + 1\n", "end" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "fl = FlexLayout(5, [2,1,2])\n", "gl = GridLayout(3,2)" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "for (r,c) in gl\n", " @show r,c\n", "end\n", "length(gl)" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Julia 0.4.0-rc4", "language": "julia", "name": "julia-0.4" }, "language_info": { "file_extension": ".jl", "mimetype": "application/julia", "name": "julia", "version": "0.4.0" } }, "nbformat": 4, "nbformat_minor": 0 }