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

Appearance settings

Deprecate AxisArtist.dpi_transform. #14747

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

Merged
merged 1 commit into from
Apr 22, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 5 additions & 0 deletions 5 doc/api/api_changes_3.3/deprecations.rst
Original file line number Diff line number Diff line change
Expand Up @@ -465,3 +465,8 @@ keyword-only, consistently with ``Colorbar``.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Passing ``None`` as either the ``radius`` or ``startangle`` of an `.Axes.pie`
is deprecated; use the explicit defaults of 1 and 0, respectively, instead.

``AxisArtist.dpi_transform``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
... is deprecated. Scale ``Figure.dpi_scale_trans`` by 1/72 to achieve the
same effect.
25 changes: 9 additions & 16 deletions 25 lib/mpl_toolkits/axisartist/axis_artist.py
Original file line number Diff line number Diff line change
Expand Up @@ -743,9 +743,10 @@ def __init__(self, axes,

if offset is None:
offset = (0, 0)
self.dpi_transform = Affine2D()
self.offset_transform = ScaledTranslation(offset[0], offset[1],
self.dpi_transform)
self.offset_transform = ScaledTranslation(
*offset,
Affine2D().scale(1 / 72) # points to inches.
+ self.axes.figure.dpi_scale_trans)

if axis_direction in ["left", "right"]:
axis_name = "ytick"
Expand All @@ -772,6 +773,11 @@ def __init__(self, axes,
self._axislabel_add_angle = 0.
self.set_axis_direction(axis_direction)

@cbook.deprecated("3.3")
@property
def dpi_transform(self):
return Affine2D().scale(1 / 72) + self.axes.figure.dpi_scale_trans

# axis direction

def set_axis_direction(self, axis_direction):
Expand Down Expand Up @@ -1181,12 +1187,7 @@ def set_label(self, s):
def get_tightbbox(self, renderer):
if not self.get_visible():
return

self._axis_artist_helper.update_lim(self.axes)

dpi_cor = renderer.points_to_pixels(1.)
self.dpi_transform.clear().scale(dpi_cor)

self._update_ticks(renderer)
self._update_label(renderer)
bb = [
Expand All @@ -1205,21 +1206,13 @@ def get_tightbbox(self, renderer):
@martist.allow_rasterization
def draw(self, renderer):
# docstring inherited

if not self.get_visible():
return

renderer.open_group(__name__, gid=self.get_gid())

self._axis_artist_helper.update_lim(self.axes)

dpi_cor = renderer.points_to_pixels(1.)
self.dpi_transform.clear().scale(dpi_cor)

self._draw_ticks(renderer)
self._draw_line(renderer)
self._draw_label(renderer)

renderer.close_group(__name__)

def toggle(self, all=None, ticks=None, ticklabels=None, label=None):
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.