# Matplotlib with hl.plot

**URL:** <https://discuss.hail.is/t/matplotlib-with-hl-plot/2447>\
**Category:** Hail Query & hailctl\
**Created:** [January 27, 2022, 6:08pm UTC](https://discuss.hail.is/t/matplotlib-with-hl-plot/2447 "2022-01-27T18:08:22Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![genome](https://avatars.discourse-cdn.com/v4/letter/g/9f8e36/32.png) [@genome](https://discuss.hail.is/u/genome)\
**Post date:** [January 27, 2022, 6:08pm UTC](https://discuss.hail.is/t/matplotlib-with-hl-plot/2447/1 "2022-01-27T18:08:22Z")

</div>

I am trying to use matplotlib to increase the aesthetics of the hail plots. Do you all have any recommendations on how to do so?

---

<div class="post-metadata">

**Author:** ![johnc1231](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.hail.is/johnc1231/32/286_2.png) [@johnc1231](https://discuss.hail.is/u/johnc1231)\
**Post date:** [January 27, 2022, 6:13pm UTC](https://discuss.hail.is/t/matplotlib-with-hl-plot/2447/2 "2022-01-27T18:13:05Z")

</div>

Hey genome,

You can’t use matplotlib to change plots generated by `hl.plot`. Those plots are generated by a library called `bokeh`, and so you’d have to use that library to make changes.

However, depending on what you’re trying to do, we have a newer plotting library that we added yesterday that is based on R’s ggplot. This library is much more flexible. It makes `plotly` plots, so also not matplotlib. [Hail | Plotting With hail.ggplot Overview](https://hail.is/docs/0.2/ggplot/index.html)

What kind of plot are you trying to make?

---

<div class="post-metadata">

**Author:** ![genome](https://avatars.discourse-cdn.com/v4/letter/g/9f8e36/32.png) [@genome](https://discuss.hail.is/u/genome)\
**Post date:** [January 27, 2022, 6:47pm UTC](https://discuss.hail.is/t/matplotlib-with-hl-plot/2447/3 "2022-01-27T18:47:14Z")

</div>

I am trying to make histograms and scatterplots. I am also thinking if I am able to extract the data into a CSV file and then plot using matplotlib. I will check out the ggplot too!

---

<div class="post-metadata">

**Author:** ![johnc1231](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.hail.is/johnc1231/32/286_2.png) [@johnc1231](https://discuss.hail.is/u/johnc1231)\
**Post date:** [January 27, 2022, 6:53pm UTC](https://discuss.hail.is/t/matplotlib-with-hl-plot/2447/4 "2022-01-27T18:53:53Z")

</div>

Yeah, ok, so I think you’ll benefit a lot from the `hl.ggplot` module. To make a scatter plot, you can do like:

```auto
from hail.ggplot import *
my_plot = ggplot(my_table, aes(x=my_table.x_field_name, y=my_table.y_field_name)) + geom_point()
my_plot.show()

```

Where you have to fill in `x_field_name` and `y_field_name`. And there’s further room to customize point size, color, title, axis labels, etc.

Note that you have to update to hail 0.2.81 if you haven’t yet to get this working.

And yes, you could definitely output to CSV and use matplotlib if you were so inclined.
