{"action":"created","issue":{"url":"https://api.github.com/repos/tbreloff/Plots.jl/issues/42","labels_url":"https://api.github.com/repos/tbreloff/Plots.jl/issues/42/labels{/name}","comments_url":"https://api.github.com/repos/tbreloff/Plots.jl/issues/42/comments","events_url":"https://api.github.com/repos/tbreloff/Plots.jl/issues/42/events","html_url":"https://github.com/tbreloff/Plots.jl/issues/42","id":110716944,"number":42,"title":"Recipes","user":{"login":"tbreloff","id":933338,"avatar_url":"https://avatars.githubusercontent.com/u/933338?v=3","gravatar_id":"","url":"https://api.github.com/users/tbreloff","html_url":"https://github.com/tbreloff","followers_url":"https://api.github.com/users/tbreloff/followers","following_url":"https://api.github.com/users/tbreloff/following{/other_user}","gists_url":"https://api.github.com/users/tbreloff/gists{/gist_id}","starred_url":"https://api.github.com/users/tbreloff/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tbreloff/subscriptions","organizations_url":"https://api.github.com/users/tbreloff/orgs","repos_url":"https://api.github.com/users/tbreloff/repos","events_url":"https://api.github.com/users/tbreloff/events{/privacy}","received_events_url":"https://api.github.com/users/tbreloff/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-10-09T18:53:41Z","updated_at":"2015-10-09T20:44:19Z","closed_at":null,"body":"I added the abstract type `PlotRecipe`, which will hopefully give a straightforward framework to create complex plots, and also give package authors nice ways to visualize parts of their packages.\r\n\r\nAn example, which could be the basis of an overlay of PCA results, among other things:\r\n\r\n![tmp](https://cloud.githubusercontent.com/assets/933338/10402427/713c60e0-6e93-11e5-8590-5d2ee549dd04.png)\r\n\r\nand the recipe is defined like:\r\n\r\n```\r\ntype EllipseRecipe <: PlotRecipe\r\n    w::Float64\r\n    h::Float64\r\n    x::Float64\r\n    y::Float64\r\n    θ::Float64\r\nend\r\nEllipseRecipe(w,h,x,y) = EllipseRecipe(w,h,x,y,0)\r\n\r\n# return x,y coords of a rotated ellipse\r\nfunction rotatedEllipse(w, h, x, y, θ, rotθ)\r\n    # # coord before rotation\r\n    xpre = w * cos(θ)\r\n    ypre = h * sin(θ)\r\n\r\n    # rotate and translate\r\n    r = rotate(xpre, ypre, rotθ)\r\n    x + r[1], y + r[2]\r\nend\r\n\r\n# implement this, and return whatever should be passed in as x/y for the plot command\r\nfunction getRecipeXY(ep::EllipseRecipe)\r\n    x, y = unzip([rotatedEllipse(ep.w, ep.h, ep.x, ep.y, u, ep.θ) for u in linspace(0,2π,100)])\r\n    top = rotate(0, ep.h, ep.θ)\r\n    right = rotate(ep.w, 0, ep.θ)\r\n    linex = Float64[top[1], 0, right[1]] + ep.x\r\n    liney = Float64[top[2], 0, right[2]] + ep.y\r\n    Any[x, linex], Any[y, liney]\r\nend\r\n\r\n# implement this, and return a Dict or list of pairs that will be splatted as keyword args\r\nfunction getRecipeArgs(ep::EllipseRecipe)\r\n    [(:line, (3, [:dot :solid], [:red :blue], :path))]\r\nend\r\n```\r\n\r\nIf anyone has ideas for cool recipes that should be included, please comment.  I'm thinking that it might make sense to have a separate repo PlotRecipes.jl which compiles a library of them..."},"comment":{"url":"https://api.github.com/repos/tbreloff/Plots.jl/issues/comments/146981827","html_url":"https://github.com/tbreloff/Plots.jl/issues/42#issuecomment-146981827","issue_url":"https://api.github.com/repos/tbreloff/Plots.jl/issues/42","id":146981827,"user":{"login":"tbreloff","id":933338,"avatar_url":"https://avatars.githubusercontent.com/u/933338?v=3","gravatar_id":"","url":"https://api.github.com/users/tbreloff","html_url":"https://github.com/tbreloff","followers_url":"https://api.github.com/users/tbreloff/followers","following_url":"https://api.github.com/users/tbreloff/following{/other_user}","gists_url":"https://api.github.com/users/tbreloff/gists{/gist_id}","starred_url":"https://api.github.com/users/tbreloff/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tbreloff/subscriptions","organizations_url":"https://api.github.com/users/tbreloff/orgs","repos_url":"https://api.github.com/users/tbreloff/repos","events_url":"https://api.github.com/users/tbreloff/events{/privacy}","received_events_url":"https://api.github.com/users/tbreloff/received_events","type":"User","site_admin":false},"created_at":"2015-10-09T20:44:19Z","updated_at":"2015-10-09T20:44:19Z","body":"I tightened up the layout and removed the inner tick labels... much nicer I think:\r\n\r\n![tmp](https://cloud.githubusercontent.com/assets/933338/10405110/d3edc89e-6ea4-11e5-942e-6976e139b684.png)\r\n"}}