{"action":"created","issue":{"url":"https://api.github.com/repos/JuliaPlots/Plots.jl/issues/787","repository_url":"https://api.github.com/repos/JuliaPlots/Plots.jl","labels_url":"https://api.github.com/repos/JuliaPlots/Plots.jl/issues/787/labels{/name}","comments_url":"https://api.github.com/repos/JuliaPlots/Plots.jl/issues/787/comments","events_url":"https://api.github.com/repos/JuliaPlots/Plots.jl/issues/787/events","html_url":"https://github.com/JuliaPlots/Plots.jl/pull/787","id":225267081,"number":787,"title":"Rewrite of histogram recipes, using StatsBase.histogram","user":{"login":"oschulz","id":546147,"avatar_url":"https://avatars1.githubusercontent.com/u/546147?v=3","gravatar_id":"","url":"https://api.github.com/users/oschulz","html_url":"https://github.com/oschulz","followers_url":"https://api.github.com/users/oschulz/followers","following_url":"https://api.github.com/users/oschulz/following{/other_user}","gists_url":"https://api.github.com/users/oschulz/gists{/gist_id}","starred_url":"https://api.github.com/users/oschulz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oschulz/subscriptions","organizations_url":"https://api.github.com/users/oschulz/orgs","repos_url":"https://api.github.com/users/oschulz/repos","events_url":"https://api.github.com/users/oschulz/events{/privacy}","received_events_url":"https://api.github.com/users/oschulz/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":10,"created_at":"2017-04-29T16:10:11Z","updated_at":"2017-05-04T08:03:20Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/JuliaPlots/Plots.jl/pulls/787","html_url":"https://github.com/JuliaPlots/Plots.jl/pull/787","diff_url":"https://github.com/JuliaPlots/Plots.jl/pull/787.diff","patch_url":"https://github.com/JuliaPlots/Plots.jl/pull/787.patch"},"body":"Continuation of #713.\r\n\r\nAlso fixes histograms with log-axes (currently badly broken, esp. for the y-axis):\r\n\r\n```\r\nusing Plots, StatsBase\r\npyplot();\r\n\r\n\r\ndata1d = filter(x -> abs(x) < 2.5, randn(10000))\r\ndata2d = (randn(1000000) - 1, - 0.1 * log(rand(1000000)))\r\n\r\nedge = -4:0.1:4\r\nh1 = fit(Histogram, data1d, edge, closed = :left)\r\nh1_norm = normalize(h1)\r\n\r\nedge_func(x) = x + 0.1 * x^3\r\ninhom_edge = map(x -> edge_func(x) / edge_func(4) * 4, -4:0.5:4)\r\nh2 = float(fit(Histogram, data1d, inhom_edge, closed = :left))\r\nh2_err = sqrt.(h2.weights)\r\nh2_norm_density = normalize(h2, mode = :density)\r\nh2_norm_pdf, h2_err_norm = normalize(h2, h2_err, mode = :pdf)\r\n\r\nh2d = fit(Histogram, data2d, nbins = (80, 120), closed = :left)\r\n\r\n\r\n\r\nplot(\r\n    plot(\r\n        h2_norm_density,\r\n        fillrange = 0,\r\n        fillalpha = 0.5,\r\n        fillcolor = :red,\r\n        # bar_width = 0.1,\r\n        yscale = :log10,\r\n    ),\r\n    plot(\r\n        h2_norm_pdf,\r\n        yerror = h2_err_norm,\r\n        seriestype = :scatter,\r\n        # xerror = 0.2,\r\n        yscale = :log10,\r\n    ),\r\n    plot(\r\n        [h1_norm, h2_norm_pdf],\r\n        xlims = (-3, 3),\r\n        seriestype = :step,\r\n        yscale = :log10,\r\n    ),\r\n    plot(h2d),\r\n    grid = false,\r\n    size = (1024, 768)\r\n)\r\n```\r\n\r\n![hists-statsbase-logy-demo](https://cloud.githubusercontent.com/assets/546147/25556921/d7fa8d10-2d06-11e7-9ef2-5e9e4c370266.png)\r\n\r\n```\r\nplot(\r\n    histogram(\r\n        data1d,\r\n        bins = inhom_edge,\r\n        normalize = :density,\r\n        fillrange = 0,\r\n        fillalpha = 0.5,\r\n        fillcolor = :red,\r\n        # bar_width = 0.1,\r\n        yscale = :log10,\r\n    ),\r\n    scatterhist(\r\n        data1d,\r\n        bins = inhom_edge,\r\n        normalize = :pdf,\r\n        yscale = :log10,\r\n    ),\r\n    begin\r\n        stephist(\r\n            data1d,\r\n            bins = edge,\r\n            normalize = :pdf, # true\r\n            xlims = (-3, 3),\r\n            markershape = :circle,\r\n            yscale = :log10,\r\n        )\r\n        stephist!(\r\n            data1d,\r\n            bins = inhom_edge,\r\n            normalize = :pdf,\r\n            xlims = (-3, 3),\r\n            markershape = :circle,\r\n            yscale = :log10,\r\n        )\r\n    end,\r\n    histogram2d(data2d..., bins = (80, 120)),\r\n    grid = false,\r\n    size = (1024, 768)\r\n)\r\n```\r\n\r\n![hists-modes-logy-demo](https://cloud.githubusercontent.com/assets/546147/25556926/eaa72ebe-2d06-11e7-98bc-1b83ca52db45.png)\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/JuliaPlots/Plots.jl/issues/comments/299120612","html_url":"https://github.com/JuliaPlots/Plots.jl/pull/787#issuecomment-299120612","issue_url":"https://api.github.com/repos/JuliaPlots/Plots.jl/issues/787","id":299120612,"user":{"login":"oschulz","id":546147,"avatar_url":"https://avatars1.githubusercontent.com/u/546147?v=3","gravatar_id":"","url":"https://api.github.com/users/oschulz","html_url":"https://github.com/oschulz","followers_url":"https://api.github.com/users/oschulz/followers","following_url":"https://api.github.com/users/oschulz/following{/other_user}","gists_url":"https://api.github.com/users/oschulz/gists{/gist_id}","starred_url":"https://api.github.com/users/oschulz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oschulz/subscriptions","organizations_url":"https://api.github.com/users/oschulz/orgs","repos_url":"https://api.github.com/users/oschulz/repos","events_url":"https://api.github.com/users/oschulz/events{/privacy}","received_events_url":"https://api.github.com/users/oschulz/received_events","type":"User","site_admin":false},"created_at":"2017-05-04T08:03:20Z","updated_at":"2017-05-04T08:03:20Z","body":"Rebased on current master."}}
{"actor":{"display_login":"oschulz"}}