Re: [Matplotlib-users] incremental colors for lines

2011-05-09 Thread Gökhan Sever
On Mon, May 9, 2011 at 5:11 PM, Pythonified wrote:

>
>
> Pythonified wrote:
> >
> > I have been trying to assign different colors for each line I plot, where
> > the colors are incrementally darkened (or lightened), or selected from a
> > colorbar (e.g. rainbow).
> >
> > Any ideas?
> >
>
> I have found a simple and better way. One can chose from colors from a
> color
> map:
>
> >>import pylab as pl
> >>import matplotlib.cm as cm
> >>xval = pl.arange(0, 20, 0.2)
> >>for i in range(256):
> ...  pl.plot(xval, pl.sin(xval)+i, c=cm.hot(i), lw=5)
>
> This one if, for instance, picking from a color map called "hot". If one
> wants to the colors to fade away, or darken, the "alpha" option can be
> utilized or another color map in which colors darken or fade into another
> color.
>
> There is no need for a long sophisticated script.
>
> Enjoy,
> Pythonified
>

Nice trick. This can go into the gallery or somewhere else in scipy
cookbook.


-- 
Gökhan
--
Achieve unprecedented app performance and reliability
What every C/C++ and Fortran developer should know.
Learn how Intel has extended the reach of its next-generation tools
to help boost performance applications - inlcuding clusters.
http://p.sf.net/sfu/intel-dev2devmay___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] incremental colors for lines

2011-05-09 Thread Pythonified


Pythonified wrote:
> 
> I have been trying to assign different colors for each line I plot, where
> the colors are incrementally darkened (or lightened), or selected from a
> colorbar (e.g. rainbow).
> 
> Any ideas?
> 

I have found a simple and better way. One can chose from colors from a color
map:

>>import pylab as pl
>>import matplotlib.cm as cm
>>xval = pl.arange(0, 20, 0.2)
>>for i in range(256):
 ...  pl.plot(xval, pl.sin(xval)+i, c=cm.hot(i), lw=5)

This one if, for instance, picking from a color map called "hot". If one
wants to the colors to fade away, or darken, the "alpha" option can be
utilized or another color map in which colors darken or fade into another
color.

There is no need for a long sophisticated script.

Enjoy,
Pythonified

-- 
View this message in context: 
http://old.nabble.com/incremental-colors-for-lines-tp31546719p31581404.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
--
Achieve unprecedented app performance and reliability
What every C/C++ and Fortran developer should know.
Learn how Intel has extended the reach of its next-generation tools
to help boost performance applications - inlcuding clusters.
http://p.sf.net/sfu/intel-dev2devmay___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] another incorrectly clipped PNG in the gallery

2011-05-09 Thread C M
On Thu, Sep 30, 2010 at 7:55 AM, Jae-Joon Lee  wrote:
> On Thu, Sep 23, 2010 at 10:31 AM, C M  wrote:
>> Until a more permanent solution is figured out, can anyone recommend
>> any workarounds, even if they are a little clunky?  I'm embedding mpl
>> plots in wxPython and am also finding this issue suboptimal.
>>
>> Che
>>
>
> A (partial) workaround is possible using the axes_grid1 toolkit (i.e.,
> you need matplotlib 1.0).
> Attached is a module I just cooked up (based on my previous attempt @
> http://www.mail-archive.com/matplotlib-users@lists.sourceforge.net/msg18129.html),
> and it seems to work quite well.
> The usage is simple.
>
>
>        ax = plt.axes([0,0,1,1])
>
>        ax.set_yticks([0.5])
>        ax.set_yticklabels(["very long label"])
>
>        make_axes_area_auto_adjustable(ax) # This is where axes_grid1 comes in
>
> Then, the axes area(including ticklabels and axis label) will be
> automatically adjusted to fit in the given extent ([0, 0, 1, 1] in the
> above case).
>
> While this is mainly for a single axes plot, you may use it with
> multi-axes plot (but somewhat trickier to use). A few examples are
> included in the module.
>

Although this has been a big improvement, there is a lingering issue
that I want to get around to cleaning up now.

When I use this workaround that Jae Joon provided, it works just fine
except that if I call canvas.draw() (because I am adding a star to a
particular marker when point picking), it causes the whole canvas to
"jump" a little bit.

What happens is that on the first call to .draw() the plot area
increases vertically a tiny amount and the title moves up slightly.
On subsequent calls, the plot surface doesn't increase vertically but
the title text moves slightly up and then down quickly.  This happens
each time I point pick for the first 5 or so times, and then it stops
doing it.  I don't even have to add any new points to the plot, just
call canvas.draw() and it will do this.

It is visually distracting and a look and feel demerit for the app for sure.

I've tried to make a sample that is not embedded in wxPython but so
far I can't reproduce the problem.

Jae Joon or anyone, any ideas about why this is occurring and how to
prevent it?  If need be I will try to work up a sample that
demonstrates it, but so far I've failed in that.

Thanks,
Che

--
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network 
management toolset available today.  Delivers lowest initial 
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Error saving to pdf with savefig on Mac OS X 10.6.7 (Snow Leopard)

2011-05-09 Thread Kaushik Kalyanaraman
Dear List,

I use Matplotlib bundled with the Enthought Python Distribution (EPD) (both 
32-bit and 64-bit versions). After a recent update, I find that my Python code 
(run either in a iPython shell or in bash shell) crashes while attempting to 
save figures to pdf files using savefig(). However, saving to other formats 
(png, ps, eps or svg) works fine. The error message echoed to the terminal are 
"Bus error" with 32-bit EPD and "Abort trap" with 64-bit EPD. Also, converting 
to pdf from one of the other four formats using *nix utilities like convert or 
ps2pdf go through fine (prompting to suspect that savefig has a bug). 
Unfortunately, in a short time, by looking at pyplot.py, I couldn't determine 
what could be causing this. Therefore, it would be really helpful if list 
members can provide any hints to fix this. I need to save a bunch of figures 
from existing code, and it would be great if I could do so without having to 
modify all savefig statements; additionally, I would prefer not to write a 
shell script to perform the conversions to pdf considering the different 
directories that my figures are saved to.

Also, a few searches using google did not throw up anything useful (although 
one relevant list archive suggested that if EPD alone is installed on a Mac, 
this error shouldn't be seen. Since this is the case for me, it didn't help.). 
The following are my specifications:

Platform: Mac OS X 10.6.7
Python version: 2.7.1
Matplotlib version: 1.0.1
EPD versions: 7.0-2 (both 32-bit and 64-bit)

(Should I also post this to matplotlib-devel ?)

Thanks and Regards,
Kaushik Kalyanaraman
--
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network 
management toolset available today.  Delivers lowest initial 
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users