Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ebbb258

Browse files
authored
Merge pull request #13362 from anntzer/get_pixel_distance_along_axis
Kill the unused, private _get_pixel_distance_along_axis.
2 parents 922dea2 + 4c532e5 commit ebbb258

File tree

1 file changed

+0
-62
lines changed

1 file changed

+0
-62
lines changed

lib/matplotlib/axis.py

Lines changed: 0 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1914,41 +1914,6 @@ def _get_offset_text(self):
19141914
self.offset_text_position = 'bottom'
19151915
return offsetText
19161916

1917-
def _get_pixel_distance_along_axis(self, where, perturb):
1918-
"""
1919-
Returns the amount, in data coordinates, that a single pixel
1920-
corresponds to in the locality given by "where", which is also given
1921-
in data coordinates, and is an x coordinate. "perturb" is the amount
1922-
to perturb the pixel. Usually +0.5 or -0.5.
1923-
1924-
Implementing this routine for an axis is optional; if present, it will
1925-
ensure that no ticks are lost due to round-off at the extreme ends of
1926-
an axis.
1927-
"""
1928-
1929-
# Note that this routine does not work for a polar axis, because of
1930-
# the 1e-10 below. To do things correctly, we need to use rmax
1931-
# instead of 1e-10 for a polar axis. But since we do not have that
1932-
# kind of information at this point, we just don't try to pad anything
1933-
# for the theta axis of a polar plot.
1934-
if self.axes.name == 'polar':
1935-
return 0.0
1936-
1937-
#
1938-
# first figure out the pixel location of the "where" point. We use
1939-
# 1e-10 for the y point, so that we remain compatible with log axes.
1940-
1941-
# transformation from data coords to display coords
1942-
trans = self.axes.transData
1943-
# transformation from display coords to data coords
1944-
transinv = trans.inverted()
1945-
pix = trans.transform_point((where, 1e-10))
1946-
# perturb the pixel
1947-
ptp = transinv.transform_point((pix[0] + perturb, pix[1]))
1948-
dx = abs(ptp[0] - where)
1949-
1950-
return dx
1951-
19521917
def set_label_position(self, position):
19531918
"""
19541919
Set the label position (top or bottom)
@@ -2261,33 +2226,6 @@ def _get_offset_text(self):
22612226
self.offset_text_position = 'left'
22622227
return offsetText
22632228

2264-
def _get_pixel_distance_along_axis(self, where, perturb):
2265-
"""
2266-
Returns the amount, in data coordinates, that a single pixel
2267-
corresponds to in the locality given by *where*, which is also given
2268-
in data coordinates, and is a y coordinate.
2269-
2270-
*perturb* is the amount to perturb the pixel. Usually +0.5 or -0.5.
2271-
2272-
Implementing this routine for an axis is optional; if present, it will
2273-
ensure that no ticks are lost due to round-off at the extreme ends of
2274-
an axis.
2275-
"""
2276-
2277-
#
2278-
# first figure out the pixel location of the "where" point. We use
2279-
# 1e-10 for the x point, so that we remain compatible with log axes.
2280-
2281-
# transformation from data coords to display coords
2282-
trans = self.axes.transData
2283-
# transformation from display coords to data coords
2284-
transinv = trans.inverted()
2285-
pix = trans.transform_point((1e-10, where))
2286-
# perturb the pixel
2287-
ptp = transinv.transform_point((pix[0], pix[1] + perturb))
2288-
dy = abs(ptp[1] - where)
2289-
return dy
2290-
22912229
def set_label_position(self, position):
22922230
"""
22932231
Set the label position (left or right)

0 commit comments

Comments
 (0)