-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
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
Closed
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 626dd6f
add rotation capabilities for scatter plot and PathCollection
mgoacolou b58bfae
PEP8 line too long
mgoacolou 2742c1b
PathCollection docstring and code revue from pelson
mgoacolou e376c46
Axes.scatter and pyplot.scatter updates with code revue from pelson
mgoacolou 9d4b4cf
update example
mgoacolou 23b79d8
Update stackplot docs for legend capabilities
dmcdougall 3527d36
Add warning for mixing AnchoredText with bad kwarg
dmcdougall b9fbc3e
Clear the Python exception when the transformation passed in does not…
mdboom 323e361
Pass an instance, rather than a type, to cleanup_path
mdboom d44e26f
Use a regular expression to handle the different output of integers o…
mdboom ea80948
Fix the link to the nosedocs and add a little more information
mdboom d9d16ae
Fix building Python integers from size_t values
cgohlke f605d36
Updated some of the documentation information.
pelson 3b32ab3
Updated license initials & copyright notice.
pelson e1662cb
Fix missed search-and-replace
mdboom 5e5cf0c
Improve message about file in old place
mdboom f1e8f6e
add rotation capabilities for scatter plot and PathCollection
mgoacolou 4ee7600
add rotation capabilities for scatter plot and PathCollection
mgoacolou c5239ea
PEP8 line too long
mgoacolou 11dbc20
PathCollection docstring and code revue from pelson
mgoacolou 9fb25cc
Axes.scatter and pyplot.scatter updates with code revue from pelson
mgoacolou 9abda5a
update example
mgoacolou 7672333
Merge branch 'v1.3.x' of github.com:mgoacolou/matplotlib into angles-…
mgoacolou b084c44
update pyplots with boilerplate.py
mgoacolou 4b0a9ce
merge master to here
mgoacolou 3c9c262
refactor and improvement from WheatherGod and NellV revue
mgoacolou File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
||
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. | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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') | ||
|
@@ -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 <[email protected]> | ||
""" | ||
|
||
from __future__ import print_function | ||
|
@@ -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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 ([email protected]) and the Agg backend by John | ||
Hunter ([email protected]) | ||
|
||
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 | ||
|
@@ -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) | ||
|
@@ -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. | ||
|
@@ -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) | ||
|
@@ -200,5 +186,4 @@ def _WX28_clipped_agg_as_bitmap(agg, bbox): | |
srcDC.SelectObject(wx.NullBitmap) | ||
destDC.SelectObject(wx.NullBitmap) | ||
|
||
return destBmp | ||
|
||
return destBmp |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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:
Would be preferable.