|
From: Eli B. <eb...@gm...> - 2010-09-20 16:13:43
|
Hello Friedrich, I tried your second solution: figure = matplotlib.figure.Figure() ... do plotting ... ... save as colour ... figure.set_gray(True) ... save as b/w ... but it gives me an error message: fig.set_gray(True) AttributeError: 'Figure' object has no attribute 'set_gray' I got the same error message when trying in in pylab as: fig1=gcf() fig1.set_gray(True) and when generating the figure with the command fig1 = matplotlib.figure.Figure() I am using matplotlib 0.99.1.1 on ubuntu 10.04/ Is there another way to do it? Thanks, Eli On Mon, Sep 20, 2010 at 11:14 AM, Friedrich Romstedt < fri...@gm...> wrote: > 2010/9/20 Eli Brosh <eb...@gm...>: > > Hello, > > I need to prepare two versions of figures: color and BW(Black&White). > > Is there an easy way to produce just the colored version and than use > some > > command or script to turn it to BW or grayscale? > > I thought that converting from color to BW really means: "in all object > in > > the figure, turn any color that is not white to black". > > Is there an easy way to implement this? > > http://github.com/friedrichromstedt/matplotlib > > I implemented a RC setting 'gray'. Turn it on by setting either > matplotlib.rcParams['gray'] = True or by setting it in your > matplotlibrc file. > > You can also gray out any artist (e.g., the figure), by calling > artist.set_gray(True). > > figure = matplotlib.figure.Figure() > ... do plotting ... > ... save as colour ... > figure.set_gray(True) > ... save as b/w ... > > If you're using pyplot or pylab, I'm not sure, but I think there is a > function gcf() which gives you the current figure object so that you > can turn gray on there. pylab support should be placed on the TODO > list, I would appreciate feedback on the preferred pylab way, since > I'm not a pylab user at all. I think a pylab function gray(boolean) > would do it. > > It's beta, so try it out. It's tested, though. > > Friedrich > |