[Matplotlib-users] colorbar() ticklabel color

2010-11-29 Thread Amit Finkler
Hi,


I am trying to produce a pcolor figure with a black background using

pylab.figure(facecolor = 'black')

Consequently, I need to change the tick colors and xlabel and ylabel
colors to white using

pylab.xlabel('whatever is on the xlabel', color = 'white', fontsize
= 14)
pylab.ylabel('whatever is on the ylabel', color = 'white', fontsize
= 14)

pylab.yticks(color = 'white')
pylab.xticks(color = 'white')


Up to this point, everything is OK. The next thing I need to do is
change the colors of the ticks and the ticklabels in the colorbar. I
understand that there are no simple pylab. commands which do so. I saw
in some matplotlib-users messages that one can write the following to
change the fontsize, for example:

for t in cb.ax.get_yticklabels():
 t.set_fontsize(14)


I tried adding another line to this loop:

 t.set_color('white')


On one hand, there is no error message during parsing or compilation. On
the other hand, nothing actually changes, i.e. the color of the
ticklabels and ticks stays black.


How does one change this property?


Amit


--
Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
Tap into the largest installed PC base & get more eyes on your game by
optimizing for Intel(R) Graphics Technology. Get started today with the
Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
http://p.sf.net/sfu/intelisp-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Labels in a dynamic graph

2008-03-25 Thread Amit Finkler


John Hunter wrote:
> On Sun, Mar 23, 2008 at 3:54 AM, Amit Finkler <[EMAIL PROTECTED]> wrote:
>
>   
>> I am using matplotlib to dynamically plot a graph with both my x and y
>> points taken from a measurement device. That is to say, in each iteration of
>> my while loop I'm reading two variables which I then want to plot with
>> matplotlib.
>> 
>
> You will want to do something like (this is just a sketch)
>
> xdata = []
> ydata = []
>
> fig = figure()
> ax = fig.add_subplot(111)
> ax.set_xlabel('my xlabel')
> ax.set_ylabel('my ylabel')
> line, = ax.plot(xdata, ydata)
>
> def add_point(x, y):
> xdata.append(x)
> ydata.append(y)
> if len(xdata)>30:  # optional, prune the early points
> del xdata[0]
> del ydata[0]
> xmin = xdata[0]
> xmax = xdata[-1]
> line.set_data(xdata, ydata)
> ax.set_xlim(xmin, xmax)
> fig.canvas.draw()
>
> while 1:
> x,y = get_data_point()
> add_point(x, y)
>
> JDH
>   
John,

Thanks for getting back to me. Indeed this works, at least when I try it
line by line. When I inserted it into my module, it shot back some error
message which goes like this:

  File
"/usr/lib/python2.4/site-packages/matplotlib/backends/backend_tkagg.py",
line 154, in draw
FigureCanvasAgg.draw(self)
  File
"/usr/lib/python2.4/site-packages/matplotlib/backends/backend_agg.py",
line 392, in draw
self.figure.draw(renderer)
  File "/usr/lib/python2.4/site-packages/matplotlib/figure.py", line
544, in draw
for a in self.axes: a.draw(renderer)
  File "/usr/lib/python2.4/site-packages/matplotlib/axes.py", line
1004, in draw
try: self.transData.freeze()  # eval the lazy objects
ValueError: Domain error on eval_scalars in Transformation::freeze

Since it did work on the console, i.e., line by line, I think it's only
a matter of resolving my own source code, unless of course you think
otherwise. By the way, isn't there a way to do the set_xlim/ylim
automatically? When I use only figure(), hold(False) and plot(X, Y), it
updates it automatically, so why doesn't it do it with the subplot?

Thanks for your help.

Amit.
-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users