Hello, On Tuesday 18 December 2007 23:42, G. O. Nikiforov wrote: > 1. Is there a way to change the font type and font size of the numbers on > the axes in a figure? Not the labels (xlabel and ylabel - they are easy to > change), but the actual numbers. If for example x goes from 0 to 6 in step > of 2, the numbers showing below the x axis would be 0, 2, 4, and 6 for > example. It is the fontsize and font of these numbers that I want to > change. It must be some axis property but I cannot figure it out.
I'm not sure that this is the right solution and it does not use an axes property, but the following works for me: -------------------------------------------------------------------------------------------------------------- import pylab pylab.figure() ax = pylab.axes() ax.plot(pylab.arange(10)) xlabels = ax.get_xticklabels() xlabel0 = xlabels[0] # one of the xtick labels xlabel0.get_fontsize() xlabel0.set_fontsize(20) pylab.show() ---------------------------------------------------------------------------------------------------------------- So finally my solution needs an iteration over a list like -------------------------------------------------------------------------------------------------------------- for xlabel_i in ax.get_xticklabels(): xlabel_i.set_fontsize(20) -------------------------------------------------------------------------------------------------------------- > 3. The data that I would like to plot is in an ASCII format, where the > first row and column is text and the rest is numbers. What would be the > best way to import that into maplotlib and then assign a variable name to > each column (without the first entry, which would be the variable name). Here again I can only present an work around, but maybe it helps you nevertheless ------------------------------------------------------------------------------------------------------- import numpy as n fp = open('test.dat', "w") fp.write('a b c \n') # write some example data fp.write('X 1 2 \n') fp.write('Y 3 4 \h') fp.close() fp = open('test.dat', "r") rows = fp.readlines() fp.close() one_row = rows[0] # one line of the saved data print one_row one_row_entries = one_row.split(' ') print one_row_entries # one would like to do something like the following to get all numbers XY = n.zeros((2, 2), dtype=n.int32) for i, row in enumerate(rows[1:]): # neglecting the first rows xy_list = row.split(' ')[1:-1] # neglecting first column and '\n' # convert to array and afterwards from string to integer values xy_array = (n.array(xy_list)).astype(n.int32) XY[i, :] = xy_array print "XY =",XY print "X =", XY[0, :], " and Y =", XY[1, :] --------------------------------------------------------------------------------------------------------------- best regards, Matthias ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users