Skip to content
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

set_scale and set_xscale #1871

Closed
gsever opened this issue Mar 29, 2013 · 3 comments · Fixed by #1917
Closed

set_scale and set_xscale #1871

gsever opened this issue Mar 29, 2013 · 3 comments · Fixed by #1917

Comments

@gsever
Copy link

gsever commented Mar 29, 2013

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

@pelson
Copy link
Member

pelson commented Mar 29, 2013

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?

@tacaswell
Copy link
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.

@mdboom
Copy link
Member

mdboom commented Apr 1, 2013

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants