Is there an emacs-lisp command which I could use to plot a collection of numbers with gnuplot, much like I can create simple line charts in Excel from an array of numbers?
For example, I would like to have a function called something like plot-with-gnuplot
which I could call with something like:
(plot-with-gnuplot '((0 0.1) (0.1 1) (0.5 10)))
and have this produce a simple line plot going through those points.
Ultimately I will be using this to view mathematical functions that I am writing, it would be useful to be able to have a quick look at how my code is coming along by drawing a simple line plot of its values over a certain range.
It is not exactly what you want but you may find Org-babel-gnuplot from org-mode useful. I've made an example file, it should work if you have gnuplot.el and emacs24. Run the first code block (C-c C-c), and then run the third code block.
test.org:
#+BEGIN_SRC emacs-lisp :results silent
;; load gnuplot mode
(require 'gnuplot "~/Dropbox/emacs/gnuplot.el")
(require 'ob-gnuplot)
#+END_SRC
#+NAME: edata
#+BEGIN_SRC emacs-lisp
'((0 0.1) (0.1 1) (0.5 10)))
#+END_SRC
#+BEGIN_SRC gnuplot :file file.png :var data=edata
plot data w lp
#+END_SRC
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With