On Thu, Nov 24, 2011 at 9:48 AM, Marianne C. <mariyann...@gmail.com> wrote:
> Hi all,
>
> My name is Marianne, I am a beginner user of matplotlib.
> I am using imshow in pyplot. I am desperate to get rid of
> the ticks on both x and y axes (see attached picture). I
> do not need the black box around the data either. Should
> I use imshow in axes.Axes instead, to be able to call
>
> set_ticks_position("none")?
>
> Thank you for your help,
> Marianne
>
> Here is the code so far:
>
> import numpy
> from matplotlib import pyplot
>
> q=numpy.loadtxt('field.txt')
>
> myfield = pyplot.imshow(q,aspect=1)
> myfield.set_clim(vmin=0, vmax=0.6)
>
> pyplot.colorbar()
>
> pyplot.savefig('field_1.eps')
>
There are a number of ways to accomplish this, but the one I use is to make
the x and y axes invisible (gets rid of the ticks) and also make the spines
invisible (gets rid of the lines). I just throw these changes into a
utility function (`clear_frame` below) and put that in a module that's on
my python path so that it's easily reusable.
Hope that helps,
-Tony
#~~~
import numpy as np
import matplotlib.pyplot as plt
def clear_frame(ax=None):
if ax is None:
ax = plt.gca()
ax.xaxis.set_visible(False)
ax.yaxis.set_visible(False)
for spine in ax.spines.itervalues():
spine.set_visible(False)
img = np.random.random((100,100))
plt.imshow(img)
clear_frame()
plt.colorbar()
plt.show()
#~~~
------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure
contains a definitive record of customers, application performance,
security threats, fraudulent activity, and more. Splunk takes this
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users