4

I was wondering how I would go about using Python to create a Graph with Mathematica. I want to be able to use python code to invoke mathematica to create a new graph, using data from a CSV file.

2

3 Answers 3

2

The old fashioned way to do what Yaroslav suggested is to just call the kernel (math) with the script switch e.g. math -script graph.m. Where graph.m is either constructed beforehand and will load the csv file or is constructed on the fly by your python program.

Can I ask why you want to use Mathematica for making the graph? There are lots of python (and other) utilities that will do it for you. There are lots of options listed here: graph survey.

Sign up to request clarification or add additional context in comments.

Comments

2

You probably need to look at PYML, which provides a Python API for Mathematica.

Depending on your needs, you might also want to look at matplotlib which would allow you to do the graphing in Python.

1 Comment

I would also go the matplotlib route.
2

You could make a Mathematica shell script and call it from Python using os.system()

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.