个人工具

“UbuntuHelp:MatPlotLibHowTo”的版本间的差异

来自Ubuntu中文

跳转至: 导航, 搜索
(新页面: {{From|https://help.ubuntu.com/community/MatPlotLibHowTo}} {{Languages|UbuntuHelp:MatPlotLibHowTo}} == What is matplotlib == [http://matplotlib.sourceforge.net/ Matplotlib] (AKA Pylab) i...)
 
第2行: 第2行:
 
{{Languages|UbuntuHelp:MatPlotLibHowTo}}
 
{{Languages|UbuntuHelp:MatPlotLibHowTo}}
 
== What is matplotlib ==
 
== What is matplotlib ==
 
 
[http://matplotlib.sourceforge.net/ Matplotlib] (AKA Pylab) is a cross platform 2d plotting library for Python.
 
[http://matplotlib.sourceforge.net/ Matplotlib] (AKA Pylab) is a cross platform 2d plotting library for Python.
 
 
Matplotlib is in the universe repository, package name "python-matplotlib".
 
Matplotlib is in the universe repository, package name "python-matplotlib".
 
 
Here's how I compiled and installed it from source before that was so.
 
Here's how I compiled and installed it from source before that was so.
 
 
== Installing dependencies  ==
 
== Installing dependencies  ==
 
 
Matplotlib works with a variety of GUI toolkits and graphical back ends.  I was most interested in the GTK and Tk interface and in the AGG back end.  For those, install the pygtk and tk -dev packages and their dependancies (breezy has tcl8.4)
 
Matplotlib works with a variety of GUI toolkits and graphical back ends.  I was most interested in the GTK and Tk interface and in the AGG back end.  For those, install the pygtk and tk -dev packages and their dependancies (breezy has tcl8.4)
 
<pre><nowiki>
 
<pre><nowiki>
第17行: 第12行:
 
</nowiki></pre>
 
</nowiki></pre>
 
Read more about the available backends at [http://matplotlib.sourceforge.net/backends.html].
 
Read more about the available backends at [http://matplotlib.sourceforge.net/backends.html].
 
 
== Installing buildtools ==
 
== Installing buildtools ==
 
 
Ubuntu does not ship with make or gcc installed by default, and [http://checkinstall.izto.org/ checkinstall] seemed like a good idea
 
Ubuntu does not ship with make or gcc installed by default, and [http://checkinstall.izto.org/ checkinstall] seemed like a good idea
 
<pre><nowiki>
 
<pre><nowiki>
第25行: 第18行:
 
</nowiki></pre>
 
</nowiki></pre>
 
Read more about compiling things on Ubuntu at CompilingEasyHowTo.
 
Read more about compiling things on Ubuntu at CompilingEasyHowTo.
 
 
== Building matplotlib ==
 
== Building matplotlib ==
 
 
Get the latest source (matplotlib-0.86.2.tar.gz as of late January 2006) from matplotlib.sf.net, unpack it, build it and install it.
 
Get the latest source (matplotlib-0.86.2.tar.gz as of late January 2006) from matplotlib.sf.net, unpack it, build it and install it.
 
<pre><nowiki>
 
<pre><nowiki>
第36行: 第27行:
 
</nowiki></pre>
 
</nowiki></pre>
 
Type whatever you like in the various package fields when checkinstall asks.  If you're going to share the resulting package with others then try to be accurate, particulary in the license field, so as to not give the wrong impression.
 
Type whatever you like in the various package fields when checkinstall asks.  If you're going to share the resulting package with others then try to be accurate, particulary in the license field, so as to not give the wrong impression.
 
 
checkinstall creates a debian package from what "python setup.py install" installed.  You can use that package to remove those files from your system using "dpkg -r matplotlib-0.86.2".  Here are two ways to see what's in that package (which is now installed, and a copy of which is in the matplotlib-0.86.2 source directory).
 
checkinstall creates a debian package from what "python setup.py install" installed.  You can use that package to remove those files from your system using "dpkg -r matplotlib-0.86.2".  Here are two ways to see what's in that package (which is now installed, and a copy of which is in the matplotlib-0.86.2 source directory).
 
<pre><nowiki>
 
<pre><nowiki>
第42行: 第32行:
 
dpkg --contents matplotlib-0.86.2_0.86.2-1_i386.deb | less
 
dpkg --contents matplotlib-0.86.2_0.86.2-1_i386.deb | less
 
</nowiki></pre>
 
</nowiki></pre>
 
 
== Using matplotlib ==
 
== Using matplotlib ==
 
 
Copy the sample matplotlibrc file from the `matplotlib-0.86.2` directory to `~/.matplotlib/matplotlibrc`
 
Copy the sample matplotlibrc file from the `matplotlib-0.86.2` directory to `~/.matplotlib/matplotlibrc`
 
 
I edited matplotlibrc changing the line
 
I edited matplotlibrc changing the line
 
<pre><nowiki>
 
<pre><nowiki>
第56行: 第43行:
 
</nowiki></pre>
 
</nowiki></pre>
 
since Numeric is already used in other parts of my application.
 
since Numeric is already used in other parts of my application.
 
 
Run some of the examples in `matplotlib-0.86.2/examples` to check that it works.  For example
 
Run some of the examples in `matplotlib-0.86.2/examples` to check that it works.  For example
 
<pre><nowiki>
 
<pre><nowiki>
 
python integral_demo.py
 
python integral_demo.py
 
</nowiki></pre>
 
</nowiki></pre>
 
 
There is a [http://matplotlib.sourceforge.net/tutorial.html tutorial] on the matplotlib home page and a [http://new.scipy.org/Wiki/Cookbook/Matplotlib cookbook] on the new SciPy wiki.
 
There is a [http://matplotlib.sourceforge.net/tutorial.html tutorial] on the matplotlib home page and a [http://new.scipy.org/Wiki/Cookbook/Matplotlib cookbook] on the new SciPy wiki.
 
 
----
 
----
 
[[category:CategoryDocumentation]] [[category:CategoryCleanup]]
 
[[category:CategoryDocumentation]] [[category:CategoryCleanup]]
  
 
[[category:UbuntuHelp]]
 
[[category:UbuntuHelp]]

2007年11月30日 (五) 20:14的版本

What is matplotlib

Matplotlib (AKA Pylab) is a cross platform 2d plotting library for Python. Matplotlib is in the universe repository, package name "python-matplotlib". Here's how I compiled and installed it from source before that was so.

Installing dependencies

Matplotlib works with a variety of GUI toolkits and graphical back ends. I was most interested in the GTK and Tk interface and in the AGG back end. For those, install the pygtk and tk -dev packages and their dependancies (breezy has tcl8.4)

sudo apt-get install python-gtk2-dev
sudo apt-get install tk8.4-dev tk8.4-doc

Read more about the available backends at [1].

Installing buildtools

Ubuntu does not ship with make or gcc installed by default, and checkinstall seemed like a good idea

sudo apt-get install build-essential checkinstall

Read more about compiling things on Ubuntu at CompilingEasyHowTo.

Building matplotlib

Get the latest source (matplotlib-0.86.2.tar.gz as of late January 2006) from matplotlib.sf.net, unpack it, build it and install it.

tar zxf matplotlib-0.86.2.tar.gz
cd matplotlib-0.86.2
python setup.py build
sudo checkinstall python setup.py install

Type whatever you like in the various package fields when checkinstall asks. If you're going to share the resulting package with others then try to be accurate, particulary in the license field, so as to not give the wrong impression. checkinstall creates a debian package from what "python setup.py install" installed. You can use that package to remove those files from your system using "dpkg -r matplotlib-0.86.2". Here are two ways to see what's in that package (which is now installed, and a copy of which is in the matplotlib-0.86.2 source directory).

dpkg -L matplotlib-0.86.2 | less
dpkg --contents matplotlib-0.86.2_0.86.2-1_i386.deb | less

Using matplotlib

Copy the sample matplotlibrc file from the `matplotlib-0.86.2` directory to `~/.matplotlib/matplotlibrc` I edited matplotlibrc changing the line

numerix      : numarray    # numpy, Numeric or numarray

to

numerix      : Numeric    # numpy, Numeric or numarray

since Numeric is already used in other parts of my application. Run some of the examples in `matplotlib-0.86.2/examples` to check that it works. For example

python integral_demo.py

There is a tutorial on the matplotlib home page and a cookbook on the new SciPy wiki.