## page was renamed from numpy
= numpy =
NumPy is a general-purpose array-processing package designed to
efficiently manipulate large multi-dimensional arrays of arbitrary
records without sacrificing too much speed for small multi-dimensional
arrays.

== Sample histogram ==
From [[http://bespokeblog.wordpress.com/2011/07/11/basic-data-plotting-with-matplotlib-part-3-histograms/]]

{{{#!highlight python
import matplotlib.pyplot as plt
from numpy.random import normal
gaussian_numbers = normal(size=1000)
plt.hist(gaussian_numbers)
plt.title("Gaussian Histogram")
plt.xlabel("Value")
plt.ylabel("Frequency")
plt.show()
}}}

== SlackBuilds ==
=== numpy ===
 * su
 * cd /tmp
 * wget http://slackbuilds.org/slackbuilds/14.0/development/numpy.tar.gz
 * tar xvzf numpy.tar.gz
 * cd numpy
 * wget http://freefr.dl.sourceforge.net/project/numpy/NumPy/1.6.2/numpy-1.6.2.tar.gz
 * ./numpy.SlackBuild
 * installpkg  /tmp/numpy-1.6.2-i486-1_SBo.tgz

Package 32 bit: [[attachment:numpy-1.6.2-i486-1_SBo.tgz]]

Package 64 bit: [[attachment:numpy-1.6.2-x86_64-1_SBo.tgz]]

=== pytz ===
 * su
 * cd /tmp
 * wget http://slackbuilds.org/slackbuilds/14.0/python/pytz.tar.gz
 * tar xvzf pytz.tar.gz
 * cd pytz
 * wget https://launchpad.net/pytz/main/2012h/+download/pytz-2012h.tar.bz2
 * ./pytz.SlackBuild
 * installpkg /tmp/pytz-2012h-i486-1_SBo.tgz 

Package 32 bit: [[attachment:pytz-2012h-i486-1_SBo.tgz]]

Package 64 bit: [[attachment:pytz-2012h-x86_64-1_SBo.tgz]]

=== python-dateutil ===
 * su
 * cd /tmp
 * wget http://slackbuilds.org/slackbuilds/14.0/python/python-dateutil.tar.gz
 * tar xvzf python-dateutil.tar.gz
 * cd python-dateutil
 * wget http://pypi.python.org/packages/source/p/python-dateutil/python-dateutil-2.1.tar.gz
 * ./python-dateutil.SlackBuild
 * installpkg /tmp/python-dateutil-2.1-i486-1_SBo.tgz 

Package 32 bit: [[attachment:python-dateutil-2.1-i486-1_SBo.tgz]]

Package 64 bit: [[attachment:python-dateutil-2.1-x86_64-1_SBo.tgz]]

=== six ===
 * su
 * cd /tmp
 * wget http://slackbuilds.org/slackbuilds/14.0/python/six.tar.gz
 * tar xvzf six.tar.gz
 * cd six
 * wget http://pypi.python.org/packages/source/s/six/six-1.4.1.tar.gz
 * ./six.SlackBuild
 * installpkg  /tmp/six-1.4.1-i486-1_SBo.tgz 

Package 32 bit: [[attachment:six-1.3.0-i486-1_SBo.tgz]]

Package 64 bit: [[attachment:six-1.4.1-x86_64-1_SBo.tgz]]

=== pysetuptools ===
 * su
 * cd /tmp
 * wget http://slackbuilds.org/slackbuilds/14.0/python/pysetuptools.tar.gz
 * tar xvzf pysetuptools.tar.gz
 * cd pysetuptools
 * wget https://pypi.python.org/packages/source/s/setuptools/setuptools-0.9.8.tar.gz
 * ./pysetuptools.SlackBuild
 * installpkg  /tmp/pysetuptools-0.9.8-i486-1_SBo.tgz

Package 32 bit: [[attachment:pysetuptools-0.8-i486-1_SBo.tgz]]

Package 64 bit: [[attachment:pysetuptools-0.9.8-x86_64-1_SBo.tgz]]

=== matplotlib ===
 * su
 * cd /tmp
 * wget http://slackbuilds.org/slackbuilds/14.0/libraries/matplotlib.tar.gz
 * tar xvzf matplotlib.tar.gz
 * cd matplotlib
 * wget http://downloads.sourceforge.net/matplotlib/matplotlib-1.1.1.tar.gz
 * ./matplotlib.SlackBuild
 * installpkg /tmp/matplotlib-1.1.1-i486-1_SBo.tgz

Package 32 bit:  [[attachment:matplotlib-1.1.1-i486-1_SBo.tgz]]

Package 64 bit: [[attachment:matplotlib-1.1.1-x86_64-1_SBo.tgz]]

== In windows ==
 * pip install numpy
 * pip install matplotlib

== Simple plot ==
 * python3 -m venv plotEnv
 * source plotEnv/bin/activate
 * pip install --upgrade pip
 * pip install numpy matplotlib pyqt5

=== simple_plot.py ===
{{{#!highlight python
# python3 simple_plot.py
import matplotlib.pyplot as plt
import numpy as np
# Data for plotting
start=0.0
end=2.0
step=0.01
x_axis = np.arange(start, end, step) # <class 'numpy.ndarray'>
y_axis = 1 + np.sin(2 * np.pi * x_axis) # <class 'numpy.ndarray'>
image, window = plt.subplots()
window.plot(x_axis, y_axis)
window.set(xlabel='x', ylabel='sin(2*pi*x)',
       title='Sin wave from 0 to 2')
window.grid()
image.savefig("test.png")
plt.show()
}}}

=== test_chart.py ===
{{{#!highlight python
# python3 test_chart.py
import matplotlib.pyplot as plt
import numpy as np
x = np.array(['a', 'b', 'c'])
y = np.array([1, 2, 3])
image, window = plt.subplots()
window.set(xlabel='x', ylabel='y',
       title='Test chart')
window.grid()
window.plot(x,y)
plt.show()
}}}