SymPyVolume

Command line 3-D Plotting tool derived from SymPy and IPyVolume.

Still a work in progress...

Installation

  • 1. Clone the Repo to your github directory
  • 2. Create an alias in bashrc for the plot.py script:

alias plot="python "$home"/github/SymPyVolume/plot.py'

You're all set. Checkout the help page for more information

usage: 3-D Plot [-h] [--Fn <class 'str'>] [--x X] [--y Y] [--z Z]
                [--axis-labels AXIS_LABELS] [--data DATA] [--color COLOR]
                [--axes_off AXES_OFF] [--box_off BOX_OFF] [--offline OFFLINE]

-------------------------------------------------------------------------------
SymPyPlot
This program can be used as a quick visual aid via:
(1) symbolic expressions (python syntax for input)
    # standard function call
    $ plot -Fn "sin(x)*cos(y)"

    # multiple functions overlaid separated by semicolon
    $ plot -Fn "x+y;4*x-y;-x+2*y"

    # limits
    $ plot -Fn "sin(x)*cos(y)" -xlim [0,50] -ylim [0,25] -zlim [-10,50]

(2) input data from file
    $ plot -f data.dat

Friendly
Please remember to use variables x,y,z.
-------------------------------------------------------------------------------

optional arguments:
  -h, --help            show this help message and exit
  --Fn <class 'str'>    Function with variables x,y,z
  --x X                 x-axis limits
  --y Y                 y-axis limits
  --z Z                 z-axis limits
  --axis-labels AXIS_LABELS
                        axis labels for plot
  --data DATA           input data file
  --color COLOR         color of surface
  --axes_off AXES_OFF   turn off the axis labels
  --box_off BOX_OFF     show the 3-D box image
  --offline OFFLINE     use offline

Examples:

Let's start with something basic:

Here's a very simple plot of $x/y$, where $0 < x < 10$, and where $0 < y < 10$

plot --Fn "x/y" --x "[0,10]" --y "[0,10]"

plot --Fn "sin(x)*cos(y)" --x "[0,10" --y "[0,10]"

We can even add more than one plot in the same figure by seperating the functions by a semicolon.

plot --Fn "sin(y)*sin(x);0.01*x-0.1*y" --x "[0,10]" --y "[0,10]"

You can even add axis labels...

plot --Fn "4*pi*x**(2)*(.001/(2*pi*y))**(3/2)*exp(-.001*x**(2)/(2*y))" --axis-labels "\nu(m/s),T(K),F(\nu)(s/m)" --x "[0,1000]" --y "[0,1000]" --z "[0,0.0095]"

$$\frac{1}{\sqrt{x^{2}+y^{2}}}$$

plot --Fn "1/sqrt(x**2+y**2)"

Morse potential (with $D_{e}=2.0$, $\alpha=1.8$ and $r_{e} = 1.0$):

$$V(r) = D_{e}(exp(-2*\alpha*(r-r_{0}))-2.0*exp(-\alpha*(r-r_{0}))),$$

where $r = \sqrt{x^{2}+y^{2}}$

plot --Fn "2.0*(exp(-2*1.8*(sqrt(x**2+y**2)-1.0))-2.0*exp(-1.8*(sqrt(x**2+y**2)-1.0)))" --x "[-5,5]" --y "[0.5,5]" --z "[-4,1]"

Lennard-Jones potential

Argon-argon interaction $\epsilon=0.185 \text{ kcal/mol}$; $\sigma=3.54 Å$; $r_{m} = 2^{(1/6)}*\sigma = 3.97Å$

$$V(r) = 4\epsilon(\frac{\sigma}{r})^{12}-(\frac{\sigma}{r})^{6})$$
plot --Fn "4*0.185*((3.54/sqrt(x**2+y**2))**12-(3.54/sqrt(x**2+y**2))**6)" --x "[-10,10]" --y "[3.37,10]" --z "[-0.6,0.3]"

Here's a pretty flower (RR 12/18/21)

plot --Fn "exp((y-x)**0.5);exp((-y+x)**0.5);exp((-y-x)**0.5);exp((y+x)**0.5);(x**2+y**2)-20;20-1/(x*y)**2" --z "[-100,100]" --color "pink" --box_off True --axes_off True