Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Polar limits enhancements#4699

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
efiring merged 14 commits intomatplotlib:masterfromQuLogic:polar-limits
Aug 21, 2017
Merged
Show file tree
Hide file tree
Changes from1 commit
Commits
Show all changes
14 commits
Select commitHold shift + click to select a range
24cd817
ENH: Add an "arc" spine type.
QuLogicJul 17, 2015
52ab847
FIX: Allow negative radii in RadialLocator and polar grids.
QuLogicJul 14, 2015
3809803
BUG: Ensure polar radial limits are nonsingular.
QuLogicJul 17, 2015
0b6cc58
ENH: Don't round degree digits when zoomed on PolarAxes.
QuLogicJul 17, 2015
2b77dbc
MNT: Standardize import in polar projection.
QuLogicJul 19, 2015
2b33d7f
MNT: Use transforms for polar direction&offset.
QuLogicJul 19, 2015
cbaee4a
ENH: Allow setting an "origin" radius for PolarAxes.
QuLogicJul 20, 2015
202f40f
ENH: Allow setting angle limits on PolarAxes.
QuLogicJul 31, 2015
b47ccba
ENH: Allow offsetting PolarAxes' zero location.
QuLogicJul 21, 2015
d549014
STY: PEP8 the rest of PolarAxes code.
QuLogicJul 21, 2015
b85c48c
DOC: Add what's new for polar axes.
QuLogicJul 22, 2015
d67a7be
Use text transform for polar ticks also.
QuLogicAug 5, 2017
734da0f
Use ordered dict for polar spines.
QuLogicAug 16, 2017
7b998e1
Update polar test images.
QuLogicAug 16, 2017
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
PrevPrevious commit
NextNext commit
STY: PEP8 the rest of PolarAxes code.
  • Loading branch information
@QuLogic
QuLogic committedAug 16, 2017
commitd549014e4dd1c95950207629b65ffa376e211e3c
71 changes: 35 additions & 36 deletionslib/matplotlib/projections/polar.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,15 @@
from __future__ import (absolute_import, division, print_function,
unicode_literals)

import six

import math
import warnings

import numpy as np

import matplotlib
rcParams = matplotlib.rcParams
from matplotlib.axes import Axes
import matplotlib.axis as maxis
from matplotlib import cbook
from matplotlib import docstring
import matplotlib.patches as mpatches
import matplotlib.path as mpath
from matplotlib import rcParams
import matplotlib.ticker as mticker
import matplotlib.transforms as mtransforms
import matplotlib.spines as mspines
Expand DownExpand Up@@ -530,8 +524,8 @@ def _set_lim_and_transforms(self):
self._yaxis_text_transform = mtransforms.TransformWrapper(
self._r_label_position + self.transData)

def get_xaxis_transform(self,which='grid'):
if which not in ['tick1','tick2','grid']:
def get_xaxis_transform(self,which='grid'):
if which not in ['tick1','tick2','grid']:
msg = "'which' must be one of [ 'tick1' | 'tick2' | 'grid' ]"
raise ValueError(msg)
return self._xaxis_transform
Expand All@@ -542,8 +536,8 @@ def get_xaxis_text1_transform(self, pad):
def get_xaxis_text2_transform(self, pad):
return self._xaxis_text2_transform, 'center', 'center'

def get_yaxis_transform(self,which='grid'):
if which not in ['tick1','tick2','grid']:
def get_yaxis_transform(self,which='grid'):
if which not in ['tick1','tick2','grid']:
msg = "'which' must be on of [ 'tick1' | 'tick2' | 'grid' ]"
raise ValueError(msg)
return self._yaxis_transform
Expand DownExpand Up@@ -715,7 +709,7 @@ def set_theta_zero_location(self, loc, offset=0.0):
'S': np.pi * 1.5,
'SE': np.pi * 1.75,
'E': 0,
'NE': np.pi * 0.25}
'NE': np.pi * 0.25}
return self.set_theta_offset(mapping[loc] + np.deg2rad(offset))

def set_theta_direction(self, direction):
Expand All@@ -736,7 +730,8 @@ def set_theta_direction(self, direction):
elif direction in (1, -1):
mtx[0, 0] = direction
else:
raise ValueError("direction must be 1, -1, clockwise or counterclockwise")
raise ValueError(
"direction must be 1, -1, clockwise or counterclockwise")
self._direction.invalidate()

def get_theta_direction(self):
Expand DownExpand Up@@ -802,6 +797,7 @@ def set_yscale(self, *args, **kwargs):

def set_rscale(self, *args, **kwargs):
return Axes.set_yscale(self, *args, **kwargs)

def set_rticks(self, *args, **kwargs):
return Axes.set_yticks(self, *args, **kwargs)

Expand DownExpand Up@@ -886,16 +882,17 @@ def set_rgrids(self, radii, labels=None, angle=None, fmt=None,

def set_xscale(self, scale, *args, **kwargs):
if scale != 'linear':
raise NotImplementedError("You can not set the xscale on a polar plot.")
raise NotImplementedError(
"You can not set the xscale on a polar plot.")

def format_coord(self, theta, r):
"""
Return a format string formatting the coordinate using Unicode
characters.
"""
if theta < 0:
theta += 2 *math.pi
theta /=math.pi
theta += 2 *np.pi
theta /=np.pi
return ('\N{GREEK SMALL LETTER THETA}=%0.3f\N{GREEK SMALL LETTER PI} '
'(%0.3f\N{DEGREE SIGN}), r=%0.3f') % (theta, theta * 180.0, r)

Expand All@@ -906,7 +903,7 @@ def get_data_ratio(self):
'''
return 1.0

### Interactive panning
# ## Interactive panning

def can_zoom(self):
"""
Expand All@@ -916,7 +913,7 @@ def can_zoom(self):
"""
return False

def can_pan(self):
def can_pan(self):
"""
Return *True* if this axes supports the pan/zoom button functionality.

Expand All@@ -938,14 +935,13 @@ def start_pan(self, x, y, button):
mode = 'zoom'

self._pan_start = cbook.Bunch(
rmax = self.get_rmax(),
trans = self.transData.frozen(),
trans_inverse = self.transData.inverted().frozen(),
r_label_angle = self.get_rlabel_position(),
x = x,
y = y,
mode = mode
)
rmax=self.get_rmax(),
trans=self.transData.frozen(),
trans_inverse=self.transData.inverted().frozen(),
r_label_angle=self.get_rlabel_position(),
x=x,
y=y,
mode=mode)

def end_pan(self):
del self._pan_start
Expand DownExpand Up@@ -979,8 +975,6 @@ def drag_pan(self, button, key, x, y):
startt, startr = p.trans_inverse.transform_point((p.x, p.y))
t, r = p.trans_inverse.transform_point((x, y))

dr = r - startr

# Deal with r
scale = r / startr
self.set_rmax(p.rmax / scale)
Expand DownExpand Up@@ -1016,7 +1010,8 @@ def drag_pan(self, button, key, x, y):
# vertices = self.transform(vertices)

# result = np.zeros((len(vertices) * 3 - 2, 2), float)
# codes = mpath.Path.CURVE4 * np.ones((len(vertices) * 3 - 2, ), mpath.Path.code_type)
# codes = mpath.Path.CURVE4 * np.ones((len(vertices) * 3 - 2, ),
# mpath.Path.code_type)
# result[0] = vertices[0]
# codes[0] = mpath.Path.MOVETO

Expand DownExpand Up@@ -1053,8 +1048,8 @@ def drag_pan(self, button, key, x, y):

# result[3::3] = p1

# printvertices[-2:]
# printresult[-2:]
# print(vertices[-2:])
# print(result[-2:])

# return mpath.Path(result, codes)

Expand All@@ -1068,12 +1063,13 @@ def drag_pan(self, button, key, x, y):
# maxtd = td.max()
# interpolate = np.ceil(maxtd / halfpi)

# print"interpolate", interpolate
# print("interpolate", interpolate)
# if interpolate > 1.0:
# vertices = self.interpolate(vertices, interpolate)

# result = np.zeros((len(vertices) * 3 - 2, 2), float)
# codes = mpath.Path.CURVE4 * np.ones((len(vertices) * 3 - 2, ), mpath.Path.code_type)
# codes = mpath.Path.CURVE4 * np.ones((len(vertices) * 3 - 2, ),
# mpath.Path.code_type)
# result[0] = vertices[0]
# codes[0] = mpath.Path.MOVETO

Expand All@@ -1095,16 +1091,19 @@ def drag_pan(self, button, key, x, y):

# result[1::3, 0] = t0 + (tkappa * td_scaled)
# result[1::3, 1] = r0*hyp_kappa
# # result[1::3, 1] = r0 / np.cos(tkappa * td_scaled) # np.sqrt(r0*r0 + ravg_kappa*ravg_kappa)
# # result[1::3, 1] = r0 / np.cos(tkappa * td_scaled)
# # np.sqrt(r0*r0 + ravg_kappa*ravg_kappa)

# result[2::3, 0] = t1 - (tkappa * td_scaled)
# result[2::3, 1] = r1*hyp_kappa
# # result[2::3, 1] = r1 / np.cos(tkappa * td_scaled) # np.sqrt(r1*r1 + ravg_kappa*ravg_kappa)
# # result[2::3, 1] = r1 / np.cos(tkappa * td_scaled)
# # np.sqrt(r1*r1 + ravg_kappa*ravg_kappa)

# result[3::3, 0] = t1
# result[3::3, 1] = r1

# print vertices[:6], result[:6], t0[:6], t1[:6], td[:6], td_scaled[:6], tkappa
# print(vertices[:6], result[:6], t0[:6], t1[:6], td[:6],
# td_scaled[:6], tkappa)
# result = self.transform(result)
# return mpath.Path(result, codes)
# transform_path_non_affine = transform_path
1 change: 0 additions & 1 deletionpytest.ini
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -42,7 +42,6 @@ pep8ignore =
matplotlib/backend_bases.py E225 E501 E712
matplotlib/projections/__init__.py E302
matplotlib/projections/geo.py E203 E221 E231 E261 E302 E402 E501 E502
matplotlib/projections/polar.py E202 E203 E221 E231 E251 E301 E402 E501
matplotlib/sphinxext/mathmpl.py E302
matplotlib/sphinxext/only_directives.py E302
matplotlib/sphinxext/plot_directive.py E261 E301 E302 E401 E402 E501
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp