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