question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Extract matplotlib axes from plotnine plots

See original GitHub issue

Seaborn has the nice feature that you can extra matplotlib Axis objects from a FacetGrid, which allows you to make low-level adjustments in matplotlib if necessary.

Is something like this possible in plotnine?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
has2k1commented, Sep 29, 2017

It is possible. If you manually call the ggplot.draw method, it returns the matplotlib figure; you then get the list of axes; then spine or Axis; and so on. e.g.

p = ggplot() + ...
fig = p.draw()
axs = fig.get_axes()
for ax in axes:
    ax.spine['top'].set(...)
    xaxis = ax.get_xaxis()
0reactions
has2k1commented, Sep 30, 2017

When Matplotlib ships the constraint layout manager, I’ll look into adding secondary axes functionality.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Making Plots With plotnine - Data Carpentry
The plotnine package is built on top of Matplotlib and interacts well with ... Then, we start modifying this plot to extract more...
Read more >
API Reference — plotnine 0.10.1 documentation
Aesthetics are the visual properties of a plot. ... Bar plot with base on the x-axis ... Create color scales using Matplotlib colormaps....
Read more >
Making beautiful boxplots using plotnine in Python
In order to initialise a boxplot we tell ggplot that diamonds is our data, and specify that our x-axis plots the cut variable...
Read more >
How to extract y-values from my regression line in plotnine ...
To display the equation on the plot, use annotate as you have. Complete code: import pandas as pd from scipy import stats from...
Read more >
Matplotlib — Visualization with Python
Make interactive figures that can zoom, pan, update. ... Join our community at discourse.matplotlib.org to get help, share your work, ... plotnine. WCS...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found