Skip to content

set_scale and set_xscale #1871

Closed
Closed

Description

@gsever

These two method calls should perform the same log scaling action. However, the output from xaxis.set_scale('log') behaves differently. See the attached figures for the difference. I am guessing yaxis counterparts behave the same way.

fig = plt.figure(figsize=(5, 5))
ax1 = fig.add_subplot(1,1,1)
ax1.plot(np.random.randn(100))

ax1.xaxis.set_scale('log')
ax1.set_xscale('log')

plt.matplotlib.__version__ 
'1.3.x'

figure_1

figure_2

Activity

  1. pelson commented on Mar 29, 2013

    @pelson
    Member

    These two method calls should perform the same log scaling action.

    I'm not so sure. If they're supposed to do the same thing, why bother having two of them?

    For my own reference, the two relevant bits in the documentation: http://matplotlib.org/api/axes_api.html#matplotlib.axes.Axes.set_xscale and http://matplotlib.org/api/axis_api.html#matplotlib.axis.Axis.set_scale (set_scale is not documented)

    Any comments @mdboom?

  2. tacaswell commented on Mar 30, 2013

    @tacaswell
    Member

    The axis.Axis.set_scale is used by Axes.set_xscale. It looks like set_scale should really be an internal function.

    set_xscale calls self.xaxis.set_scale and then self._update_transscale which then gets the scale back from the x and y axis objects and uses the results to update the transform the objects in self.lines use to draw them selves.

  3. mdboom commented on Apr 1, 2013

    @mdboom
    Member

    Yeah -- I think Axis.set_scale really should be private. Of course, some may be using it, so we'll have to retain a public wrapper around it that throws a deprecation warning for a while.

  4. added a commit that references this issue on Apr 18, 2013
    4003603
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions