Bug in set_yscale?

Hi

I’m trying to use the linthershy option for symlog in matplotlib.axes.Axes.set_yscale()
``for values smaller than 1, but the plot then shows large values (vertical lines) for the points which should have been in the linear range. My code is:

import matplotlib.pyplot as plt
import numpy as np

f1 = np.loadtxt(‘someDataFile.txt’) # file has all y values smaller than 1

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

ax1.plot(f1[:, 0], f1[:, 1])

ax1.set_yscale(‘symlog’, linthreshy = 1e-3)
ax1.set_ylim(1e-4, 1)
ax1.autoscale(enable = True, axis = ‘x’, tight = True)

plt.draw()
plt.show()

···

Another and testable code is

import matplotlib
matplotlib.use(‘Qt4Agg’)
import matplotlib.pyplot as plt
import numpy as np

fig1 = plt.figure(1)
A = 10 + 9.999999999 * np.sin(2 * np.pi * np.arange(0.01, 1, 0.01))

ax1 = fig1.add_subplot(111)
ax1.plot(A)

ax1.set_yscale(‘symlog’, linthreshy = 1e-6)
ax1.set_ylim(0, 20) # change this to ax1.set_ylim(0, 0.7) for strange lines

fig2 = plt.figure(2)
ax2 = fig2.add_subplot(111)
ax2.plot(A)
ax2.set_yscale(‘log’)
ax2.set_ylim(0, 20)
ax2.autoscale(enable = True, axis = ‘both’, tight = True)

plt.draw()
plt.show()

Which does not show correct labels and the linear part is gone (only a straight line).
Does anyone have a solution for these problems?

Regards

Pål

This was a bug found fairly recently. In the case where the linthresh was less than 1.0:

http://sourceforge.net/tracker/index.php?func=detail&aid=3081451&group_id=80706&atid=560720

I don’t know if the patch was backported to the maintenance branch, but I am fairly sure it would have been.

I hope this was helpful,
Ben Root

···

On Tue, Nov 2, 2010 at 8:20 AM, Pål Gunnar Ellingsen <paalge@…287…> wrote:

Hi

I’m trying to use the linthershy option for symlog in matplotlib.axes.Axes.set_yscale()
``for values smaller than 1, but the plot then shows large values (vertical lines) for the points which should have been in the linear range. My code is:

import matplotlib.pyplot as plt
import numpy as np

f1 = np.loadtxt(‘someDataFile.txt’) # file has all y values smaller than 1

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

ax1.plot(f1[:, 0], f1[:, 1])

ax1.set_yscale(‘symlog’, linthreshy = 1e-3)
ax1.set_ylim(1e-4, 1)
ax1.autoscale(enable = True, axis = ‘x’, tight = True)

plt.draw()
plt.show()

Another and testable code is

import matplotlib
matplotlib.use(‘Qt4Agg’)
import matplotlib.pyplot as plt
import numpy as np

fig1 = plt.figure(1)
A = 10 + 9.999999999 * np.sin(2 * np.pi * np.arange(0.01, 1, 0.01))

ax1 = fig1.add_subplot(111)
ax1.plot(A)

ax1.set_yscale(‘symlog’, linthreshy = 1e-6)
ax1.set_ylim(0, 20) # change this to ax1.set_ylim(0, 0.7) for strange lines

fig2 = plt.figure(2)
ax2 = fig2.add_subplot(111)

ax2.plot(A)
ax2.set_yscale(‘log’)
ax2.set_ylim(0, 20)
ax2.autoscale(enable = True, axis = ‘both’, tight = True)

plt.draw()
plt.show()

Which does not show correct labels and the linear part is gone (only a straight line).

Does anyone have a solution for these problems?

Regards

Pål

Hi

Thank you.
I installed the latest from svn and it now works.

Regards

Pål

···

On 2 November 2010 15:21, Benjamin Root <ben.root@…1304…> wrote:

On Tue, Nov 2, 2010 at 8:20 AM, Pål Gunnar Ellingsen <paalge@…287…> wrote:

Hi

I’m trying to use the linthershy option for symlog in matplotlib.axes.Axes.set_yscale()
``for values smaller than 1, but the plot then shows large values (vertical lines) for the points which should have been in the linear range. My code is:

import matplotlib.pyplot as plt
import numpy as np

f1 = np.loadtxt(‘someDataFile.txt’) # file has all y values smaller than 1

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

ax1.plot(f1[:, 0], f1[:, 1])

ax1.set_yscale(‘symlog’, linthreshy = 1e-3)
ax1.set_ylim(1e-4, 1)
ax1.autoscale(enable = True, axis = ‘x’, tight = True)

plt.draw()
plt.show()

Another and testable code is

import matplotlib
matplotlib.use(‘Qt4Agg’)
import matplotlib.pyplot as plt
import numpy as np

fig1 = plt.figure(1)
A = 10 + 9.999999999 * np.sin(2 * np.pi * np.arange(0.01, 1, 0.01))

ax1 = fig1.add_subplot(111)
ax1.plot(A)

ax1.set_yscale(‘symlog’, linthreshy = 1e-6)
ax1.set_ylim(0, 20) # change this to ax1.set_ylim(0, 0.7) for strange lines

fig2 = plt.figure(2)
ax2 = fig2.add_subplot(111)

ax2.plot(A)
ax2.set_yscale(‘log’)
ax2.set_ylim(0, 20)
ax2.autoscale(enable = True, axis = ‘both’, tight = True)

plt.draw()
plt.show()

Which does not show correct labels and the linear part is gone (only a straight line).

Does anyone have a solution for these problems?

Regards

Pål

This was a bug found fairly recently. In the case where the linthresh was less than 1.0:

http://sourceforge.net/tracker/index.php?func=detail&aid=3081451&group_id=80706&atid=560720

I don’t know if the patch was backported to the maintenance branch, but I am fairly sure it would have been.

I hope this was helpful,
Ben Root