### Bug report **Bug summary** The ``RectangleSelector`` example in the docs at https://matplotlib.org/3.2.1/api/widgets_api.html#matplotlib.widgets.RectangleSelector doesn't seem to produce a rectangle that renders correctly. **Code for reproduction** The example code at https://matplotlib.org/3.2.1/api/widgets_api.html#matplotlib.widgets.RectangleSelector, namely: ```python import numpy as np import matplotlib.pyplot as plt from matplotlib.widgets import RectangleSelector def onselect(eclick, erelease): "eclick and erelease are matplotlib events at press and release." print('startposition: (%f, %f)' % (eclick.xdata, eclick.ydata)) print('endposition : (%f, %f)' % (erelease.xdata, erelease.ydata)) print('used button : ', eclick.button) def toggle_selector(event): print('Key pressed.') if event.key in ['Q', 'q'] and toggle_selector.RS.active: print('RectangleSelector deactivated.') toggle_selector.RS.set_active(False) if event.key in ['A', 'a'] and not toggle_selector.RS.active: print('RectangleSelector activated.') toggle_selector.RS.set_active(True) x = np.arange(100.) / 99 y = np.sin(x) fig, ax = plt.subplots() ax.plot(x, y) toggle_selector.RS = RectangleSelector(ax, onselect, drawtype='line') fig.canvas.mpl_connect('key_press_event', toggle_selector) plt.show() ``` **Actual outcome**  **Expected outcome** I expected a rectangle to be drawn. **Matplotlib version** * Operating system: Ubuntu 20.04 * Matplotlib version: 3.2.1 (from pip) * Matplotlib backend (`print(matplotlib.get_backend())`): Qt5Agg * Python version: 3.8.2
Activity
astrofrog commentedon May 21, 2020
Ah I think this was because the example defaults to drawtype='line' - I think this is a bit confusing as a default and 'box' might make more sense?
QuLogic commentedon May 21, 2020
Why does
drawtype='line'exist for something called a RectangleSelector? I think we should change that example to be less confusing.timhoffm commentedon May 21, 2020
The example was removed in favor of a link to the gallery. #17475 (comment), which uses `drawtype='box', which is also the default.
Still, I have no clue what
drawtype='line'could reasonably be used for. Maybe we should deprecate it?sjvrijn commentedon Jul 23, 2021
Does the merge of #19934 mean this issue can be closed?
anntzer commentedon Jul 23, 2021
yes, thanks for pointing this out.