astropy / astropy/astroplan

Find better way to fix image cropping in docs.

Open
#65 4 comments 0 reactions 0 assignees View on GitHub
bug question
Dominant language
Python
Stars
225
Forks
121
Avg merge
28m
Merged PRs (30d)
1

Description

Docs use Matplotlib's [`.. plot::` directive](http://matplotlib.org/devel/documenting_mpl.html?highlight=sphinx#module-matplotlib.sphinxext.plot_directive), which incorrectly crops off edges of images produced by plotting code (see Matplotlib issue [here](https://github.com/matplotlib/matplotlib/issues/4563), resulting in behavior like that below:

![plot_image_crop_bug](https://cloud.githubusercontent.com/assets/11530948/9390876/d2b3fab4-4741-11e5-8bdb-9fb9db790db1.png)

Need to find a better way to fix this other than sticking the following block of code before every `plt.show()` instance, as this obscures the `astroplan` code that the docs are meant to illustrate:

```
# Note that you don't need this code block to produce the plot.
# It reduces the plot size for the documentation.
ax = plt.gca()
box = ax.get_position()
ax.set_position([box.x0, box.y0, box.width * 0.75, box.height * 0.75])
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reading the documentation examples that use Matplotlib's `.. plot::` directive and reproduce the reported edge cropping. Compare the directive behavior with the per-example `plt.show()` workaround; done means documentation plots retain their image edges without adding that workaround to every example.

Written by the indexing model from the issue text.

Assessment

Tech stack
matplotlib, python
Domain
data-visualization, documentation
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.