Newbie Question...

Thanks for all who gave me a reply.... Somehow the

    > following script worked...:

    import matplotlib
    matplotlib.interactive(False)
    matplotlib.use("WX")

    from matplotlib.matlab import *
    plot([1,2,3,4])
    show()

I just want to point out that in my opinion, the easiest way to set
the default backend is to use your matplotlibrc file -
http://matplotlib.sourceforge.net/faq.html#MATPLOTLIBRC. For windows,
this is found at C:\Python23\share\matplotlib\.matplotlibrc.

You can achieve the same effect by setting

    backend : WX # the default backend
    interactive : False # see http://matplotlib.sourceforge.net/interactive.html

which will not be so invasive to your script (ie, you can change the
default behavior of your scripts w/o changing the scripts
themselves). Using

    import matplotlib
    matplotlib.interactive(False)
    matplotlib.use("WX")

should be something you reserve to depart from the desired default
behavior.

Glad it's working for you! I have two more questions I am curious
about, for both you and Barry

  * Does WXAgg also work?

  * In which IDEs do you find this combination works?

Following your question yesterday I added the FAQ entry
http://matplotlib.sourceforge.net/faq.html#FREEZE, and I'd like to
update it to make it as complete as possible.

JDH

John,
I tested with DrPython 2.4.2, PyPe 1.9, PythonWin,
Idle, SciTE 1.6, and, my usual dev environment,
UltraEdit 10.20b.

Only SciTE hasn't worked so far; it exits with the
error:

Fatal Python error: PyEval_RestoreThread: NULL tstate

Even from a Win shell (DOS) the disappearing window
problem occurred until I inserted the line

matplotlib.interactive(False)

Idle seems to fail on the second run with error:

Unhandled exception at 0x1e0078d4 in pythonw.exe:
0xC0000005: Access violation reading location
0x00000004.

In the MS debugger I see the disassembled code:

1E0078CF nop
1E0078D0 mov edx,dword ptr [esp+4]
1E0078D4 mov ecx,dword ptr [edx+4]

where it breaks on the last line.

Thanks for the pointer on the matplotlibrc file. I'll
switch to using that from now on (more *nix-like
anyway).

Barry

--- John Hunter wrote:
> >>>>> "Ryugan" == Ryugan Mizuta
> <ryuganmizuta@...209...> writes:
>
> Ryugan> Thanks for all who gave me a
reply....
> Somehow the
> Ryugan> following script worked...:
>
> import matplotlib
> matplotlib.interactive(False)
> matplotlib.use("WX")
>
> from matplotlib.matlab import *
> plot([1,2,3,4])
> show()
>
>
> I just want to point out that in my opinion, the
> easiest way to set
> the default backend is to use your matplotlibrc
file
> -
>
http://matplotlib.sourceforge.net/faq.html#MATPLOTLIBRC.
> For windows,
> this is found at
> C:\Python23\share\matplotlib\.matplotlibrc.
>
> You can achieve the same effect by setting
>
> backend : WX # the default backend
> interactive : False # see
>
http://matplotlib.sourceforge.net/interactive.html
>
> which will not be so invasive to your script (ie,
> you can change the
> default behavior of your scripts w/o changing the
> scripts
> themselves). Using
>
> import matplotlib
> matplotlib.interactive(False)
> matplotlib.use("WX")
>
> should be something you reserve to depart from
the
> desired default
> behavior.
>
> Glad it's working for you! I have two more
> questions I am curious
> about, for both you and Barry
>
> * Does WXAgg also work?
>
> * In which IDEs do you find this combination
> works?
>
> Following your question yesterday I added the FAQ
> entry
>
http://matplotlib.sourceforge.net/faq.html#FREEZE,
> and I'd like to
> update it to make it as complete as possible.
>
> JDH
>
>
>

···

-------------------------------------------------------
> This SF.Net email is sponsored by The 2004
> JavaOne(SM) Conference
> Learn from the experts at JavaOne(SM), Sun's
> Worldwide Java Developer
> Conference, June 28 - July 1 at the Moscone
Center
> in San Francisco, CA
> REGISTER AND SAVE! http://java.sun.com/javaone/sf
> Priority Code NWMGYKND
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
>
https://lists.sourceforge.net/lists/listinfo/matplotlib-users