All, I am trying to render a set of data/date points with
> plot_date. How can I get matplotlib to only plot the y
> axis of this graph? I can turn both off with axis("off"),
> but I can't seem to find more detailed instructions
> anywhere. Also, although this is unimportant, it grates
You have to make the individual elements invisible. Something like
for label in ax.get_xticklabels():
label.set_visible(False)
For more refined control, for each tick there are a host of visibility
properties you can set
gridOn : a boolean which determines whether to draw the tickline
tick1On : a boolean which determines whether to draw the 1st tickline
tick2On : a boolean which determines whether to draw the 2nd tickline
label1On : a boolean which determines whether to draw tick label
label2On : a boolean which determines whether to draw tick label
for tick in ax.xaxis.get_major_ticks():
tick.tick2On = False
and likewise for the minor ticks
> somewhat to use matplotlib with the procedural (matlab
> esque) instructions within my OO python code. Are there
> any tutorials or other docs on plotting graphs through
> the more pythonic libraries?
As the code above illustrates, matplotlib is an OO library. There is
no requirement to use it through the procedural pylab interface. Most
of my personal use, except for quick scripts and interactive sessions,
is OO.
See this FAQ
http://matplotlib.sourceforge.net/faq.html#OO
and this tutorial
http://matplotlib.sourceforge.net/leftwich_tut.txt
A nice hybrid approach is to use a minimum of pylab for figure
management only, and do everything else through OO
import matplotlib.numerix as nx
from pylab import figure, close, show # all you need
x = nx.arange(0, 2.0, 0.01)
y = nx.sin(2*nx.pi*x)
fig1 = figure(1)
fig2 = figure(2)
ax1 = fig1.add_subplot(211)
ax1.plot(x,y)
ax1.set_xlabel('time (s)')
ax1.set_ylabel('volts')
ax1.set_title('a sinusoid')
ax1.grid(True)
# and more with fig2, etc....
show()
Most of the action is in the Axes instance, and too a lesser extent
the Figure and Axis instances, so see the class documentation for the
figure, axes, and axis methods
http://matplotlib.sourceforge.net/classdocs.html
Hope this helps,
JDH