Skip to content

Rotate markers in Scatter plot #2432

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 27 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
f8ec9aa
add rotation capabilities for scatter plot and PathCollection
mgoacolou Sep 17, 2013
626dd6f
add rotation capabilities for scatter plot and PathCollection
mgoacolou Sep 17, 2013
b58bfae
PEP8 line too long
mgoacolou Sep 18, 2013
2742c1b
PathCollection docstring and code revue from pelson
mgoacolou Sep 18, 2013
e376c46
Axes.scatter and pyplot.scatter updates with code revue from pelson
mgoacolou Sep 18, 2013
9d4b4cf
update example
mgoacolou Sep 18, 2013
23b79d8
Update stackplot docs for legend capabilities
dmcdougall Jun 22, 2013
3527d36
Add warning for mixing AnchoredText with bad kwarg
dmcdougall Jun 28, 2013
b9fbc3e
Clear the Python exception when the transformation passed in does not…
mdboom Jul 2, 2013
323e361
Pass an instance, rather than a type, to cleanup_path
mdboom Jul 2, 2013
d44e26f
Use a regular expression to handle the different output of integers o…
mdboom Jul 2, 2013
ea80948
Fix the link to the nosedocs and add a little more information
mdboom Jul 2, 2013
d9d16ae
Fix building Python integers from size_t values
cgohlke Jun 1, 2013
f605d36
Updated some of the documentation information.
pelson Mar 11, 2013
3b32ab3
Updated license initials & copyright notice.
pelson Mar 12, 2013
e1662cb
Fix missed search-and-replace
mdboom Jul 3, 2013
5e5cf0c
Improve message about file in old place
mdboom Jul 16, 2013
f1e8f6e
add rotation capabilities for scatter plot and PathCollection
mgoacolou Sep 17, 2013
4ee7600
add rotation capabilities for scatter plot and PathCollection
mgoacolou Sep 17, 2013
c5239ea
PEP8 line too long
mgoacolou Sep 18, 2013
11dbc20
PathCollection docstring and code revue from pelson
mgoacolou Sep 18, 2013
9fb25cc
Axes.scatter and pyplot.scatter updates with code revue from pelson
mgoacolou Sep 18, 2013
9abda5a
update example
mgoacolou Sep 18, 2013
7672333
Merge branch 'v1.3.x' of github.com:mgoacolou/matplotlib into angles-…
mgoacolou Sep 18, 2013
b084c44
update pyplots with boilerplate.py
mgoacolou Sep 18, 2013
4b0a9ce
merge master to here
mgoacolou Sep 18, 2013
3c9c262
refactor and improvement from WheatherGod and NellV revue
mgoacolou Sep 18, 2013
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@

# General substitutions.
project = 'Matplotlib'
copyright = '2013 John Hunter, Darren Dale, Eric Firing, Michael Droettboom and the matplotlib development team'
copyright = '2002 - 2012 John Hunter, Darren Dale, Eric Firing, Michael Droettboom and the matplotlib development team; 2012 - 2013 The matplotlib development team'

# The default replacements for |version| and |release|, also used in various
# other places throughout the built documents.
Expand Down
2 changes: 1 addition & 1 deletion doc/devel/documenting_mpl.rst
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ An example save command to generate a movie looks like this

ani.save('double_pendulum.mp4', fps=15)

Contact John Hunter for the login password to upload youtube videos of
Contact Michael Droettboom for the login password to upload youtube videos of
google docs to the mplgithub account.

.. _referring-to-mpl-docs:
Expand Down
76 changes: 76 additions & 0 deletions doc/users/license.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,86 @@ licenses. Non-BSD compatible licenses (eg LGPL) are acceptable in
matplotlib toolkits. For a discussion of the motivations behind the
licencing choice, see :ref:`license-discussion`.

Copyright Policy
================

John Hunter began matplotlib around 2003. Since shortly before his
passing in 2012, Michael Droettboom has been the lead maintainer of
matplotlib, but, as has always been the case, matplotlib is the work
of many.

Prior to July of 2013, and the 1.3.0 release, the copyright of the
source code was held by John Hunter. As of July 2013, and the 1.3.0
release, matplotlib has moved to a shared copyright model.

matplotlib uses a shared copyright model. Each contributor maintains
copyright over their contributions to matplotlib. But, it is important to
note that these contributions are typically only changes to the
repositories. Thus, the matplotlib source code, in its entirety, is not
the copyright of any single person or institution. Instead, it is the
collective copyright of the entire matplotlib Development Team. If
individual contributors want to maintain a record of what
changes/contributions they have specific copyright on, they should
indicate their copyright in the commit message of the change, when
they commit the change to one of the matplotlib repositories.

The Matplotlib Development Team is the set of all contributors to the
matplotlib project. A full list can be obtained from the git version
control logs.

License agreement for matplotlib |version|
==============================================

1. This LICENSE AGREEMENT is between the Matplotlib Development Team
("MDT"), and the Individual or Organization ("Licensee") accessing and
otherwise using matplotlib software in source or binary form and its
associated documentation.

. Subject to the terms and conditions of this License Agreement, MDT
hereby grants Licensee a nonexclusive, royalty-free, world-wide license
to reproduce, analyze, test, perform and/or display publicly, prepare
derivative works, distribute, and otherwise use matplotlib |version|
alone or in any derivative version, provided, however, that MDT's
License Agreement and MDT's notice of copyright, i.e., "Copyright (c)
2012-2013 Matplotlib Development Team; All Rights Reserved" are retained in
matplotlib |version| alone or in any derivative version prepared by
Licensee.

3. In the event Licensee prepares a derivative work that is based on or
incorporates matplotlib |version| or any part thereof, and wants to
make the derivative work available to others as provided herein, then
Licensee hereby agrees to include in any such work a brief summary of
the changes made to matplotlib |version|.

4. MDT is making matplotlib |version| available to Licensee on an "AS
IS" basis. MDT MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR
IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, MDT MAKES NO AND
DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS
FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF MATPLOTLIB |version|
WILL NOT INFRINGE ANY THIRD PARTY RIGHTS.

5. MDT SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF MATPLOTLIB
|version| FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR
LOSS AS A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING
MATPLOTLIB |version|, OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF
THE POSSIBILITY THEREOF.

6. This License Agreement will automatically terminate upon a material
breach of its terms and conditions.

7. Nothing in this License Agreement shall be deemed to create any
relationship of agency, partnership, or joint venture between MDT and
Licensee. This License Agreement does not grant permission to use MDT
trademarks or trade name in a trademark sense to endorse or promote
products or services of Licensee, or any third party.

8. By copying, installing or otherwise using matplotlib |version|,
Licensee agrees to be bound by the terms and conditions of this License
Agreement.

License agreement for matplotlib versions prior to 1.3.0
========================================================

1. This LICENSE AGREEMENT is between John D. Hunter ("JDH"), and the
Individual or Organization ("Licensee") accessing and otherwise using
matplotlib software in source or binary form and its associated
Expand Down
15 changes: 15 additions & 0 deletions examples/pylab_examples/scatter_rotate_symbol.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.markers import TICKRIGHT
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not the biggest fan of the style of this example. I think using the standard:

import numpy as np
import numpy.random
import matplotlib.pyplot as plt
from matplotlib.markers import TICKRIGHT

Would be preferable.


rx, ry = 3., 1.
area = rx * ry * np.pi
angles = np.linspace(0., 360., 30.)

x, y, sizes, colors = np.random.rand(4, 30)
sizes *= 20**2.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for 2 newlines

plt.scatter(x, y, sizes, colors, marker="o",zorder=2)
plt.scatter(x, y, 2.5*sizes, colors, marker=TICKRIGHT, angles=angles, zorder=2)

plt.show()
6 changes: 3 additions & 3 deletions lib/matplotlib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -718,11 +718,11 @@ def matplotlib_fname():
fname == os.path.join(
get_home(), '.matplotlib', 'matplotlibrc')):
warnings.warn(
"Found matplotlib configuration in ~/.matplotlib. "
"Found matplotlib configuration in ~/.matplotlib/. "
"To conform with the XDG base directory standard, "
"this configuration location has been deprecated "
"on Linux, and the new location is now %r. Please "
"move your configuration there to ensure that "
"on Linux, and the new location is now %r/matplotlib/. "
"Please move your configuration there to ensure that "
"matplotlib will continue to find it in the future." %
_get_xdg_config_dir())
return fname
Expand Down
43 changes: 16 additions & 27 deletions lib/matplotlib/afm.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,27 @@
"""
This is a python interface to Adobe Font Metrics Files. Although a
number of other python implementations exist (and may be more complete
than mine) I decided not to go with them because either they were
either
number of other python implementations exist, and may be more complete
than this, it was decided not to go with them because they were
either:

1) copyrighted or used a non-BSD compatible license

2) had too many dependencies and I wanted a free standing lib
2) had too many dependencies and a free standing lib was needed

3) Did more than I needed and it was easier to write my own than
figure out how to just get what I needed from theirs
3) Did more than needed and it was easier to write afresh rather than
figure out how to get just what was needed.

It is pretty easy to use, and requires only built-in python libs::
It is pretty easy to use, and requires only built-in python libs:

>>> from afm import AFM
>>> fh = open('ptmr8a.afm')
>>> afm = AFM(fh)
>>> from matplotlib import rcParams
>>> import os.path
>>> afm_fname = os.path.join(rcParams['datapath'],
... 'fonts', 'afm', 'ptmr8a.afm')
>>>
>>> from matplotlib.afm import AFM
>>> afm = AFM(open(afm_fname))
>>> afm.string_width_height('What the heck?')
(6220.0, 683)
(6220.0, 694)
>>> afm.get_fontname()
'Times-Roman'
>>> afm.get_kern_dist('A', 'f')
Expand All @@ -26,12 +30,7 @@
-92.0
>>> afm.get_bbox_char('!')
[130, -9, 238, 676]
>>> afm.get_bbox_font()
[-168, -218, 1000, 898]


AUTHOR:
John D. Hunter <jdh2358@gmail.com>
"""

from __future__ import print_function
Expand Down Expand Up @@ -549,14 +548,4 @@ def get_vertical_stem_width(self):
Return the standard vertical stem width as float, or *None* if
not specified in AFM file.
"""
return self._header.get(b'StdVW', None)


if __name__ == '__main__':
#pathname = '/usr/local/lib/R/afm/'
pathname = '/usr/local/share/fonts/afms/adobe'

for fname in os.listdir(pathname):
with open(os.path.join(pathname, fname)) as fh:
afm = AFM(fh)
w, h = afm.string_width_height('John Hunter is the Man!')
return self._header.get(b'StdVW', None)
10 changes: 7 additions & 3 deletions lib/matplotlib/axes/_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -3134,7 +3134,7 @@ def dopatch(xs, ys):
medians=medians, fliers=fliers)

@docstring.dedent_interpd
def scatter(self, x, y, s=20, c='b', marker='o', cmap=None, norm=None,
def scatter(self, x, y, s=20, c='b', marker='o', angles=0, cmap=None, norm=None,
vmin=None, vmax=None, alpha=None, linewidths=None,
verts=None, **kwargs):
"""
Expand Down Expand Up @@ -3162,6 +3162,9 @@ def scatter(self, x, y, s=20, c='b', marker='o', cmap=None, norm=None,
See `~matplotlib.markers` for more information on the different
styles of markers scatter supports.

angles : scalar or array_like, shape (n, ), optional, default: 0
degrees counter clock-wise from X axis

cmap : `~matplotlib.colors.Colormap`, optional, default: None
A `~matplotlib.colors.Colormap` instance or registered name.
`cmap` is only used if `c` is an array of floats. If None,
Expand Down Expand Up @@ -3222,14 +3225,15 @@ def scatter(self, x, y, s=20, c='b', marker='o', cmap=None, norm=None,
raise ValueError("x and y must be the same size")

s = np.ma.ravel(s) # This doesn't have to match x, y in size.
angles = np.ma.ravel(angles) # This doesn't have to match x, y in size.

c_is_stringy = is_string_like(c) or is_sequence_of_strings(c)
if not c_is_stringy:
c = np.asanyarray(c)
if c.size == x.size:
c = np.ma.ravel(c)

x, y, s, c = cbook.delete_masked_points(x, y, s, c)
x, y, s, c, angles = cbook.delete_masked_points(x, y, s, c, angles)

scales = s # Renamed for readability below.

Expand Down Expand Up @@ -3265,7 +3269,7 @@ def scatter(self, x, y, s=20, c='b', marker='o', cmap=None, norm=None,
edgecolors = 'face'

collection = mcoll.PathCollection(
(path,), scales,
(path,), scales, angles,
facecolors=colors,
edgecolors=edgecolors,
linewidths=linewidths,
Expand Down
23 changes: 4 additions & 19 deletions lib/matplotlib/backends/backend_wxagg.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,3 @@
"""

backend_wxagg.py

A wxPython backend for Agg. This uses the GUI widgets written by
Jeremy O'Donoghue (jeremy@o-donoghue.com) and the Agg backend by John
Hunter (jdhunter@ace.bsd.uchicago.edu)

Copyright (C) 2003-5 Jeremy O'Donoghue, John Hunter, Illinois Institute of
Technology


License: This work is licensed under the matplotlib license( PSF
compatible). A copy should be included with this source code.

"""

from __future__ import division, print_function
import matplotlib
from matplotlib.figure import Figure
Expand All @@ -26,6 +9,7 @@
draw_if_interactive, show, Toolbar, backend_version
import wx


class FigureFrameWxAgg(FigureFrameWx):
def get_canvas(self, fig):
return FigureCanvasWxAgg(self, -1, fig)
Expand All @@ -40,6 +24,7 @@ def _get_toolbar(self, statbar):
toolbar = None
return toolbar


class FigureCanvasWxAgg(FigureCanvasAgg, FigureCanvasWx):
"""
The FigureCanvas contains the figure and does event handling.
Expand Down Expand Up @@ -105,6 +90,7 @@ def print_figure(self, filename, *args, **kwargs):
if self._isDrawn:
self.draw()


class NavigationToolbar2WxAgg(NavigationToolbar2Wx):
def get_canvas(self, frame, fig):
return FigureCanvasWxAgg(frame, -1, fig)
Expand Down Expand Up @@ -200,5 +186,4 @@ def _WX28_clipped_agg_as_bitmap(agg, bbox):
srcDC.SelectObject(wx.NullBitmap)
destDC.SelectObject(wx.NullBitmap)

return destBmp

return destBmp
2 changes: 1 addition & 1 deletion lib/matplotlib/cbook.py
Original file line number Diff line number Diff line change
Expand Up @@ -1617,7 +1617,7 @@ class Grouper(object):
>>> grp.join(b, c)
>>> grp.join(d, e)
>>> sorted(map(tuple, grp))
[(d, e), (a, b, c)]
[(a, b, c), (d, e)]
>>> grp.joined(a, b)
True
>>> grp.joined(a, c)
Expand Down
Loading