[Matplotlib-users] Struggle with ticker.SymmetricalLogLocator()
Eric Firing
efiring at hawaii.edu
Fri Mar 18 20:12:35 EDT 2016
On 2016/02/15 12:03 AM, superchinchilla wrote:
> Hi,
>
> I want to make a symmetric logarithmic plot, but unfortunately the y-values
> are overlapping around 0. I don't want to display the first values around 0.
> I'm not sure how to use the ticker.SymmetricalLogLocator command to change
> the ticklocations or the tickfrequencies. I searched for a long time but
> didn't find any proper solution for it besides the examples for the normal
> Loglocater which didn't work. I tried to understand how the
> ticker.SymmetricalLogLocator(transform, subs=None) instance is working on
> the matplotlib documentation side which is not an easy target for me. I only
> want that the first ticklabes around zero are not displayed in my plot.
>
> I'm using the plt.yscale('symlog') command in order to plot it symmetrically
> around zero. My picture looks like
>
> <http://matplotlib.1069221.n5.nabble.com/file/n46753/heat1_raten1.png>
> Sorry for my bad English,
> thanx for any help in advance
I'm sorry for the long delay, but in case you haven't found a solution
yet, here is an example of one way of handling the situation:
import matplotlib.pyplot as plt
import numpy as np
dt = 0.01
x = np.arange(-50.0, 50.0, dt)
y = np.arange(0, 100.0, dt)
fig, ax = plt.subplots()
ax.plot(y, x)
ax.set_yscale('symlog')
ax.set_ylabel('symlogy')
ylabs = ax.yaxis.get_ticklabels()
i0 = int(len(ylabs) // 2)
for label in ylabs[i0-1:i0+2]:
label.set_visible(False)
plt.show()
-----
Eric
>
>
>
> --
> View this message in context: http://matplotlib.1069221.n5.nabble.com/Struggle-with-ticker-SymmetricalLogLocator-tp46753.html
> Sent from the matplotlib - users mailing list archive at Nabble.com.
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users at python.org
> https://mail.python.org/mailman/listinfo/matplotlib-users
>
More information about the Matplotlib-users
mailing list