plot function now works similar to dropdowncalc
This commit is contained in:
parent
e997d37346
commit
0d0401540e
@ -1,34 +1,30 @@
|
||||
#!/bin/bash
|
||||
echo $1
|
||||
sed "9s/.*/func = lambda x: $1/" "/home/alex/.local/bin/tools/plotter.py" > /tmp/plotter_temp.py
|
||||
if [ ! -z $(echo $2 | grep "a=") ]; then
|
||||
echo $2
|
||||
echo "Has found attribute a="
|
||||
sed "13s/.*/$2/" "/tmp/plotter_temp.py" > /tmp/plotter_temp2.py
|
||||
cat "/tmp/plotter_temp2.py" > /tmp/plotter_temp.py
|
||||
a=0
|
||||
#!/bin/sh
|
||||
|
||||
if [ $# -eq 1 ]; then
|
||||
A=0
|
||||
B=1
|
||||
F="$( echo "$1" | sed -E 's/\"//g' )"
|
||||
elif [ $# -eq 2 ]; then
|
||||
A=0
|
||||
B="$1"
|
||||
F="$( echo "$2" | sed -E 's/\"//g' )"
|
||||
|
||||
elif [ $# -eq 3 ]; then
|
||||
A="$1"
|
||||
B="$2"
|
||||
F="$( echo "$3" | sed -E 's/\"//g' )"
|
||||
else
|
||||
echo "Please use 1,2 or 3 arguments for plotting"
|
||||
exit
|
||||
fi
|
||||
|
||||
if [ ! -z $(echo $3 | grep "b=") ]; then
|
||||
echo $3
|
||||
echo "has found attribute b="
|
||||
sed "14s/.*/$3/" "/tmp/plotter_temp.py" > /tmp/plotter_temp2.py
|
||||
cat "/tmp/plotter_temp2.py" > /tmp/plotter_temp.py
|
||||
b=0
|
||||
fi
|
||||
python -c "from numpy import *
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
if [ -z $(echo $2 | grep "a=") ]; then
|
||||
echo $2
|
||||
a=$2
|
||||
fi
|
||||
def plot(a, b, f):
|
||||
x = linspace(a, b, 1000)
|
||||
y = eval(f)
|
||||
plt.plot(x, y)
|
||||
plt.show()
|
||||
|
||||
if [ -z $(echo $3 | grep "b=") ]; then
|
||||
echo $3
|
||||
b=$3
|
||||
fi
|
||||
|
||||
rm -f /tmp/plotter_temp2.py
|
||||
python /tmp/plotter_temp.py "$1" $2 $3
|
||||
sxiv -b /tmp/plot.png
|
||||
rm -f /tmp/plot.png
|
||||
#rm /tmp/plotter_temp.py
|
||||
plot($A,$B,\"$F\")"
|
||||
|
Loading…
Reference in New Issue
Block a user