Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Make default arrow head width sensible #1186

Merged
merged 2 commits into from

3 participants

@dmcdougall
Collaborator

Currently the default head width is too small to produce a visible arrow head by default, this explains the behaviour described in #1096. It is not the case that there is not enough information in the documentation to plot an arrow.

@travisbot

This pull request fails (merged d636190 into cf7618c).

@pelson
Collaborator

What do these magic numbers mean? Why is 20 of them better than 3 of them? (other than experimental evidence)
Perhaps these magic numbers could be dropped into the rcParams?

This change will need an entry in the api changelog.

@dmcdougall
Collaborator

Yes, so it's unclear. The FancyArrow docstring is also not clear about what they are. The kwarg width is the width of the arrow tail. Its default value is 0.001, but the docstring does not say what the units are. My first reaction was to say they in points, but I think thats too small. The kwarg head_width controls the width of the arrow head, its default is set to three times that of width. This would mean the units are the same but, again, I don't know what they are.

@dmcdougall
Collaborator

Would we prefer an rcParam for this instead? I'm starting to think that would be a better approach...

@pelson
Collaborator

Would we prefer an rcParam for this instead?

I'm not sure about this now. The scale factor is only used when a user hasn't specified an arrow width - if the user were looking to change this they should set the width directly rather than setting a scale factor indirectly in rcParams.

Personally I'd be happy to merge this if you wouldn't mind re-basing?

dmcdougall added some commits
@dmcdougall dmcdougall Make default arrow head width sensible
Currently the default head width is too small to produce a visible arrow
head by default, so make it bigger.
7458091
@dmcdougall dmcdougall Update api change to reflect new default 07ffe75
@dmcdougall
Collaborator

Done.

@pelson
Collaborator

:+1:. Anybody else want to comment? If not, I'll merge in the next 48 hrs.

Cheers @dmcdougall

@dmcdougall
Collaborator

@pelson Want to go ahead with this?

@pelson pelson merged commit 6be9771 into matplotlib:master

1 check passed

Details default The Travis build passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 30, 2013
  1. @dmcdougall

    Make default arrow head width sensible

    dmcdougall authored
    Currently the default head width is too small to produce a visible arrow
    head by default, so make it bigger.
  2. @dmcdougall
This page is out of date. Refresh to see the latest.
Showing with 5 additions and 1 deletion.
  1. +4 −0 doc/api/api_changes.rst
  2. +1 −1  lib/matplotlib/patches.py
View
4 doc/api/api_changes.rst
@@ -15,6 +15,10 @@ For new features that were added to matplotlib, please see
Changes in 1.3.x
================
+* In :class:`~matplotlib.patches.FancyArrow`, the default arrow head width,
+ ``head_width``, has been made larger to produce a visible arrow head. The new
+ value of this kwarg is ``head_width = 20 * width``.
+
* Removed call of :meth:`~matplotlib.axes.Axes.grid` in
:meth:`~matplotlib.pyplot.plotfile`. To draw the axes grid, set to *True*
matplotlib.rcParams['axes.grid'] or ``axes.grid`` in ``.matplotlibrc`` or
View
2  lib/matplotlib/patches.py
@@ -1021,7 +1021,7 @@ def __init__(self, x, y, dx, dy, width=0.001, length_includes_head=False,
"""
if head_width is None:
- head_width = 3 * width
+ head_width = 20 * width
if head_length is None:
head_length = 1.5 * head_width
Something went wrong with that request. Please try again.