These are the contents of mydata.dat file:
--------------------------------------
8 4.3950
16 7.7879
24 11.0650
32 14.4312
40 17.3884
48 21.6769
56 23.7509
64 27.7398
72 31.5975
80 35.7720
88 39.2403
96 44.0992
----------------------------
Note: The separation between numbers is a tab space.
-------------------------------------------
$ pyxplot
____ __ ______ _ _ PYXPLOT
| _ \ _ _\ \/ / _ \| | ___ | |_ Version 0.6.3.1
| |_) | | | |\ /| |_) | |/ _ \| __| 26/02/2007
| __/| |_| |/ \| __/| | (_) | |_
|_| \__, /_/\_\_| |_|\___/ \__| Copyright (C) 2006-7 Dominic Ford
|___/
With thanks to Joerg Lehmann and Andre Wobst for writing PyX, and to
Ross Church for his many helpful suggestions along the way.
Send comments, bug reports, feature requests and coffee supplies to:
coders@pyxplot.org.uk
pyxplot> set ylabel 'Average'
pyxplot> set xlabel 'n'
pyxplot> plot 'mydata.dat'
pyxplot> exit
Goodbye. Have a nice day.
coders@pyxplot.org.uk
------------------------------------
Other examples:
Bar Charts
Script
set multiplot
set nodisplay
set samples 25
width=7
gold_ratio = 1/((1+sqrt(5))/2)
set width width
set xrange [-10.9:10.9]
set yrange [-1.2:1.2]
set nokey
# Plot 0 (bottom left)
set xlabel 'x'
set ylabel 'y'
set label 1 '(a)' at -9,0.8
set label 2 'histeps' -3.7,0.8
plot 'example6.dat' with histeps, 'example6.dat' with points
# Plot 1 (bottom right)
set origin 1*width, 0*width*gold_ratio
set xlabel 'x'
set ylabel 'linkaxis 0'
set label 1 '(b)' at -9,0.8
set label 2 'boxes' -3.7,0.8
plot 'example6.dat' with boxes, 'example6.dat' with points
# Plot 2 (middle left)
set origin 0*width, 1*width*gold_ratio
set xlabel 'linkaxis 0'
set ylabel 'y'
set label 1 '(c)' at -9,0.8
set label 2 'fsteps' -3.7,0.8
plot 'example6.dat' with fsteps, 'example6.dat' with points
# Plot 3 (middle right)
set origin 1*width, 1*width*gold_ratio
set xlabel 'linkaxis 1'
set ylabel 'linkaxis 2'
set label 1 '(d)' at -9,0.8
set label 2 'steps' -3.7,0.8
plot 'example6.dat' with steps, 'example6.dat' with points
# Plot 4 (top left)
set origin 0*width, 2*width*gold_ratio
set xlabel 'linkaxis 0'
set ylabel 'y'
set label 1 '(e)' at -9,0.8
set label 2 'impulses' -3.7,0.8
plot 'example6.dat' with impulses, 'example6.dat' with points
# Plot 5 (top right)
set origin 1*width, 2*width*gold_ratio
set boxfrom -0.5
set xlabel 'linkaxis 1'
set ylabel 'linkaxis 4'
set label 1 '(f)' at -9,0.8
set label 2 'boxes' -3.7,0.8
plot 'example6.dat' with boxes, 'example6.dat' with points
set display
refresh
Monday, March 30, 2009
Sunday, March 29, 2009
Python: Random numbers
(link to webpage)
>>> random.random() # Random float x, 0.0 <= x <>
0.37444887175646646
>>> random.uniform(1, 10) # Random float x, 1.0 <= x <>
1.1800146073117523
>>> random.randint(1, 10) # Integer from 1 to 10, endpoints included
7
>>> random.randrange(0, 101, 2) # Even integer from 0 to 100
26
>>> random.choice('abcdefghij') # Choose a random element
'c'
>>> items = [1, 2, 3, 4, 5, 6, 7]
>>> random.shuffle(items)
>>> items
[7, 3, 2, 5, 6, 4, 1]
>>> random.sample([1, 2, 3, 4, 5], 3) # Choose 3 elements
[4, 1, 5]
---------------------------------
Using the Random Module
-------------------------------------------
>>> random.random() # Random float x, 0.0 <= x <>
0.37444887175646646
>>> random.uniform(1, 10) # Random float x, 1.0 <= x <>
1.1800146073117523
>>> random.randint(1, 10) # Integer from 1 to 10, endpoints included
7
>>> random.randrange(0, 101, 2) # Even integer from 0 to 100
26
>>> random.choice('abcdefghij') # Choose a random element
'c'
>>> items = [1, 2, 3, 4, 5, 6, 7]
>>> random.shuffle(items)
>>> items
[7, 3, 2, 5, 6, 4, 1]
>>> random.sample([1, 2, 3, 4, 5], 3) # Choose 3 elements
[4, 1, 5]
---------------------------------
Using the Random Module
(link)
>>> import random
>>> # 0.0 <= float <>
>>> random.random()
0.41360177662769904
>>> # 10.0 <= float <>
>>> random.uniform(10,20)
15.743669918803288
>>> # 10 <= int <= 20 (can be 20)
>>> random.randint(10,20)
10
>>> # 10 <= int < step="2) random.randrange(10,20,2)
16
>>> # choose from a list
>>> random.choice([1, 2, 3, 5, 9])
2
>>> # make a list into random order
>>> cards = range(52)
>>> random.shuffle(cards) # order is random now
>>> cards[:5] # get 5 cards
[37, 14, 42, 44, 6]
Wednesday, March 04, 2009
Mommy, I found it! — 15 Practical Linux Find Command Examples
One very basic example with the command 'find':
find . -name '*.txt' -type f
(link to article)
This article is written by SathiyaMoorthy
Apart from the basic operation of looking for files under a directory structure, you can also perform several practical operations using find command that will make your command line journey easy.
In this article, let us review 15 practical examples of Linux find command that will be very useful to both newbies and experts.
find . -name '*.txt' -type f
(link to article)
This article is written by SathiyaMoorthy
Apart from the basic operation of looking for files under a directory structure, you can also perform several practical operations using find command that will make your command line journey easy.
In this article, let us review 15 practical examples of Linux find command that will be very useful to both newbies and experts.
Monday, March 02, 2009
Configuring a printer
With the next command you can call the printer GUI configurator in Ubuntu.
$ sudo system-config-printer
$ sudo system-config-printer
Subscribe to:
Posts (Atom)