Hi

I've been trying to do a twiny() plot in matplotlib, but I've run into a
problem with the ticks when using autoscale with the tight option.


My second xaxis is a function of the first.
An example would be:

-----------------
import numpy as np
import matplotlib.pyplot as plt

Radius = np.arange(32)
Theta = np.sin(np.arange(32))
fig1 = plt.figure()
ax1 = fig1.add_subplot(111)

ax1.plot(Radius, Theta, linestyle='-', marker='.', c='b', markersize=5)

print(ax1.get_xticks())
plt.show()


fig1 = plt.figure()
ax1 = fig1.add_subplot(111)

ax1.plot(Radius, Theta, linestyle='-', marker='.', c='b', markersize=5)


ax1.autoscale(tight=True)

print('This should be different')
print(ax1.get_xticks())  # Should not be the same as the last print

plt.show()


This would be a problem if I now were to do:

ax2 = ax1.twiny()

ax2.set_xticks(ax1.get_xticks())

ax2.set_xticklabels(someFunction(ax1.get_xticks()))


Is this a problem with the tight=True option?
Do I have to manually set all the limits?


Cheers

Paul
------------------------------------------------------------------------------
Shape the Mobile Experience: Free Subscription
Software experts and developers: Be at the forefront of tech innovation.
Intel(R) Software Adrenaline delivers strategic insight and game-changing 
conversations that shape the rapidly evolving mobile landscape. Sign up now. 
http://pubads.g.doubleclick.net/gampad/clk?id=63431311&iu=/4140/ostg.clktrk
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to