Size: 879
Comment:
|
← Revision 28 as of 2023-06-01 18:34:40 ⇥
Size: 4438
Comment:
|
Deletions are marked like this. | Additions are marked like this. |
Line 1: | Line 1: |
## page was renamed from numpy | |
Line 2: | Line 3: |
NumPy is a general-purpose array-processing package designed to | [[https://numpy.org/|NumPy]] is a general-purpose array-processing package designed to |
Line 7: | Line 8: |
== SlackBuild == * 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 |
== 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 === {{{#!highlight sh 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 }}} |
Line 19: | Line 37: |
== 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 64 bit: [[attachment:numpy-1.6.2-x86_64-1_SBo.tgz]] === pytz === {{{#!highlight sh 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 === {{{#!highlight sh 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 === {{{#!highlight sh 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 === {{{#!highlight sh 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 === {{{#!highlight sh 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 == {{{#!highlight sh 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() }}} |
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/
SlackBuilds
numpy
Package 32 bit: numpy-1.6.2-i486-1_SBo.tgz
Package 64 bit: numpy-1.6.2-x86_64-1_SBo.tgz
pytz
Package 32 bit: pytz-2012h-i486-1_SBo.tgz
Package 64 bit: pytz-2012h-x86_64-1_SBo.tgz
python-dateutil
1 su
2 cd /tmp
3 wget http://slackbuilds.org/slackbuilds/14.0/python/python-dateutil.tar.gz
4 tar xvzf python-dateutil.tar.gz
5 cd python-dateutil
6 wget http://pypi.python.org/packages/source/p/python-dateutil/python-dateutil-2.1.tar.gz
7 ./python-dateutil.SlackBuild
8 installpkg /tmp/python-dateutil-2.1-i486-1_SBo.tgz
Package 32 bit: python-dateutil-2.1-i486-1_SBo.tgz
Package 64 bit: python-dateutil-2.1-x86_64-1_SBo.tgz
six
Package 32 bit: six-1.3.0-i486-1_SBo.tgz
Package 64 bit: six-1.4.1-x86_64-1_SBo.tgz
pysetuptools
1 su
2 cd /tmp
3 wget http://slackbuilds.org/slackbuilds/14.0/python/pysetuptools.tar.gz
4 tar xvzf pysetuptools.tar.gz
5 cd pysetuptools
6 wget https://pypi.python.org/packages/source/s/setuptools/setuptools-0.9.8.tar.gz
7 ./pysetuptools.SlackBuild
8 installpkg /tmp/pysetuptools-0.9.8-i486-1_SBo.tgz
Package 32 bit: pysetuptools-0.8-i486-1_SBo.tgz
Package 64 bit: pysetuptools-0.9.8-x86_64-1_SBo.tgz
matplotlib
Package 32 bit: matplotlib-1.1.1-i486-1_SBo.tgz
Package 64 bit: matplotlib-1.1.1-x86_64-1_SBo.tgz
In windows
- pip install numpy
- pip install matplotlib
Simple plot
simple_plot.py
1 # python3 simple_plot.py
2 import matplotlib.pyplot as plt
3 import numpy as np
4 # Data for plotting
5 start=0.0
6 end=2.0
7 step=0.01
8 x_axis = np.arange(start, end, step) # <class 'numpy.ndarray'>
9 y_axis = 1 + np.sin(2 * np.pi * x_axis) # <class 'numpy.ndarray'>
10 image, window = plt.subplots()
11 window.plot(x_axis, y_axis)
12 window.set(xlabel='x', ylabel='sin(2*pi*x)',
13 title='Sin wave from 0 to 2')
14 window.grid()
15 image.savefig("test.png")
16 plt.show()