# Plotting a histogram in Julia

**URL:** <https://discourse.julialang.org/t/plotting-a-histogram-in-julia/20361>\
**Category:** New to Julia\
**Tags:** plotting\
**Created:** [February 1, 2019, 4:56pm UTC](https://discourse.julialang.org/t/plotting-a-histogram-in-julia/20361 "2019-02-01T16:56:37Z")\
**Posts on this page:** 4\
**Page:** 2

<div class="post-metadata">

**Author:** ![jbrea](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jbrea/32/3879_2.png) [@jbrea](https://discourse.julialang.org/u/jbrea)\
**Post date:** [February 2, 2019, 10:40am UTC](https://discourse.julialang.org/t/plotting-a-histogram-in-julia/20361/21 "2019-02-02T10:40:19Z")

</div>

The problem was

```julia
julia> pyplot()

```

which tells `Plots` to use the Matplotlib backend, even if `GR` is correctly installed.

---

<div class="post-metadata">

**Author:** ![davidanthoff](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/davidanthoff/32/223493_2.png) [@davidanthoff](https://discourse.julialang.org/u/davidanthoff)\
**Post date:** [February 2, 2019, 5:08pm UTC](https://discourse.julialang.org/t/plotting-a-histogram-in-julia/20361/22 "2019-02-02T17:08:15Z")

</div>

> [@mkborregaard](#):
>
> Are more intuitive syntaxes for things like this, and trendlines, etc., in the works for VegaLite, or are there philosophical reasons to not go that way?

On trendlines, the answer is simple: yes. But that work needs to happen in vega-lite itself, not the julia wrapper. I know the dev team there has that on their roadmap, so hopefully some day it will just magically appear 🙂

The question on alternative APIs is a bit more difficult. My thinking right now is that I don’t think more canned plotting APIs belong in [VegaLite.jl](https://github.com/fredo-dedup/VegaLite.jl) itself, I think that package should probably stick to the grammar of graphics API style. BUT, I think it would be awesome to have another package that sits on top of [VegaLite.jl](https://github.com/fredo-dedup/VegaLite.jl) that might have APIs like `histogram(data)`. The [Vega.jl](http://johnmyleswhite.github.io/Vega.jl/histogram.html) package actually had that sort of API, but I think that package is not active/working right now (not 100% sure, though). Another option would probably be to create a vega/vega-lite backend for [Plots.jl](https://github.com/JuliaPlots/Plots.jl), right?

---

<div class="post-metadata">

**Author:** ![mkborregaard](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkborregaard/32/556_2.png) [@mkborregaard](https://discourse.julialang.org/u/mkborregaard)\
**Post date:** [February 2, 2019, 5:28pm UTC](https://discourse.julialang.org/t/plotting-a-histogram-in-julia/20361/23 "2019-02-02T17:28:05Z")

</div>

That’s an option, but in my way making it a Plots backend would take away a lot of what’s nice with VegaLite, which is the GOG interface. Well, maybe VegaLite JSON could be automatically translated to Plots recipes, at which point the functionality would go both ways - an interesting project!

---

<div class="post-metadata">

**Author:** ![davidanthoff](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/davidanthoff/32/223493_2.png) [@davidanthoff](https://discourse.julialang.org/u/davidanthoff)\
**Post date:** [February 2, 2019, 5:54pm UTC](https://discourse.julialang.org/t/plotting-a-histogram-in-julia/20361/24 "2019-02-02T17:54:51Z")

</div>

Well, I certainly wouldn’t want to take the GOG interface away! But I think we could _also_ provide a more Plots.jl like interface. And I just don’t know whether that would be better achieved via a Plots.jl backend or a separate, standalone API. Or something Makie.jl related? I have to admit I’m not on top of the current roadmap for that ecosystem 🙂

[Previous page](https://discourse.julialang.org/t/plotting-a-histogram-in-julia/20361.md?page=1)
