* gnuplot question - "Specify an entire line to be inserted in the Gnuplot script." @ 2011-07-29 19:29 Michael Gilbert 2011-07-29 19:52 ` Eric Schulte 0 siblings, 1 reply; 6+ messages in thread From: Michael Gilbert @ 2011-07-29 19:29 UTC (permalink / raw) To: emacs-orgmode Mailinglist Hi — There is a single line in the OM manual (currently on p32) which reads: line Specify an entire line to be inserted in the Gnuplot script. I am trying to insert a couple of horizontal reference lines in a simple plot. I have the plot working, but I need an example of this to help me along. The Gnuplot manual is a monster all its own and I'm not even sure the format is exactly the same. At any rate, I'm a little stuck. Any advice? — Michael Nonprofit News http://nonprofitnews.org ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: gnuplot question - "Specify an entire line to be inserted in the Gnuplot script." 2011-07-29 19:29 gnuplot question - "Specify an entire line to be inserted in the Gnuplot script." Michael Gilbert @ 2011-07-29 19:52 ` Eric Schulte 2011-07-29 22:48 ` Michael C Gilbert 0 siblings, 1 reply; 6+ messages in thread From: Eric Schulte @ 2011-07-29 19:52 UTC (permalink / raw) To: Michael Gilbert; +Cc: emacs-orgmode Mailinglist [-- Attachment #1: Type: text/plain, Size: 505 bytes --] Hi Michael, I would recommending using a gnuplot code block rather than a plot line, and passing your data to the code block using a variable. Code blocks give you much more direct access to gnuplot, which I find generally makes gnuplot learning/debugging much easier. see http://orgmode.org/manual/Working-With-Source-Code.html add something like this to your config (org-babel-do-load-languages 'org-babel-load-languages '((gnuplot . t))) then try something like the following Best -- Eric [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: simple-gnuplot-tests.org --] [-- Type: text/x-org, Size: 1091 bytes --] ** simple gnuplot tests #+results: some-more-gnuplot | 1 | 1 | | 2 | 4 | | 3 | 9 | | 4 | 16 | | 5 | 25 | | 6 | 36 | | 7 | 49 | | 8 | 64 | #+TBLFM: $2=$1*$1 #+begin_src gnuplot :var data=some-more-gnuplot plot "$data" #+end_src #+results: Plotting data points from a table could look like this: #+tblname: basic-plot | x | y1 | y2 | |-----+------------+------------| | 0.1 | 0.425 | 0.375 | | 0.2 | 0.3125 | 0.3375 | | 0.3 | 0.24999993 | 0.28333338 | | 0.4 | 0.275 | 0.28125 | | 0.5 | 0.26 | 0.27 | | 0.6 | 0.25833338 | 0.24999993 | | 0.7 | 0.24642845 | 0.23928553 | | 0.8 | 0.23125 | 0.2375 | | 0.9 | 0.23333323 | 0.2333332 | | 1 | 0.2225 | 0.22 | #+begin_src gnuplot :var data=basic-plot :exports code :file basic-plot.png set title "Putting it All Together" set xlabel "X" set xrange [0:1] set xtics 0,0.1,1 set ylabel "Y" set yrange [0.2:0.5] set ytics 0.2,0.05,0.5 plot data u 1:2 w p lw 2 title 'x vs. y1', \ data u 1:3 w lp lw 1 title 'x vx. y2' #+end_src #+results: [[file:basic-plot.png]] [-- Attachment #3: Type: text/plain, Size: 649 bytes --] Michael Gilbert <mcg@gilbert.org> writes: > Hi — > > There is a single line in the OM manual (currently on p32) which reads: > > line Specify an entire line to be inserted in the Gnuplot script. > > I am trying to insert a couple of horizontal reference lines in a > simple plot. I have the plot working, but I need an example of this to > help me along. The Gnuplot manual is a monster all its own and I'm not > even sure the format is exactly the same. At any rate, I'm a little > stuck. Any advice? > > — Michael > > Nonprofit News > http://nonprofitnews.org > > > -- Eric Schulte http://cs.unm.edu/~eschulte/ ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: gnuplot question - "Specify an entire line to be inserted in the Gnuplot script." 2011-07-29 19:52 ` Eric Schulte @ 2011-07-29 22:48 ` Michael C Gilbert 2011-07-29 22:52 ` Eric Schulte 2011-07-29 23:41 ` Nick Dokos 0 siblings, 2 replies; 6+ messages in thread From: Michael C Gilbert @ 2011-07-29 22:48 UTC (permalink / raw) To: emacs-orgmode Mailinglist On Jul 29, 2011, at 12:52 PM, Eric Schulte wrote: > I would recommending using a gnuplot code block rather than a plot line, > and passing your data to the code block using a variable. Code blocks > give you much more direct access to gnuplot, which I find generally > makes gnuplot learning/debugging much easier. > > see http://orgmode.org/manual/Working-With-Source-Code.html <snip> Thank you, Eric. You're generous with your time and you're absolutely correct. This is the direction I will go. There's no doubt that this seems the right way to go for anything sophisticated. And like most solutions, it will then end up my standard approach. However, it also means I will put this off for a little while until I'm ready to do it right. Maybe just a few days, but... That means that, in the mean time, if you or anyone has an example of how to configure this using the line: formatting, it would still be useful to me and I would still be grateful. I just have something small I need to produce tonight or tomorrow, for doing some simple blood pressure tracking. I have everything working except a couple of reference lines running across the plot. I'm figuring since it's in the documentation, there must be something somewhere that shows the syntax, yes? — Michael ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: gnuplot question - "Specify an entire line to be inserted in the Gnuplot script." 2011-07-29 22:48 ` Michael C Gilbert @ 2011-07-29 22:52 ` Eric Schulte 2011-07-29 23:06 ` Michael C Gilbert 2011-07-29 23:41 ` Nick Dokos 1 sibling, 1 reply; 6+ messages in thread From: Eric Schulte @ 2011-07-29 22:52 UTC (permalink / raw) To: Michael C Gilbert; +Cc: emacs-orgmode Mailinglist Michael C Gilbert <mcg@gilbert.org> writes: > > On Jul 29, 2011, at 12:52 PM, Eric Schulte wrote: > >> I would recommending using a gnuplot code block rather than a plot line, >> and passing your data to the code block using a variable. Code blocks >> give you much more direct access to gnuplot, which I find generally >> makes gnuplot learning/debugging much easier. >> >> see http://orgmode.org/manual/Working-With-Source-Code.html > > <snip> > > Thank you, Eric. You're generous with your time Happy to help, and I already had the example usage on hand. > and you're absolutely correct. This is the direction I will > go. There's no doubt that this seems the right way to go for anything > sophisticated. And like most solutions, it will then end up my > standard approach. However, it also means I will put this off for a > little while until I'm ready to do it right. Maybe just a few days, > but... > > That means that, in the mean time, if you or anyone has an example of > how to configure this using the line: formatting, it would still be > useful to me and I would still be grateful. I just have something > small I need to produce tonight or tomorrow, for doing some simple > blood pressure tracking. I have everything working except a couple of > reference lines running across the plot. I'm figuring since it's in > the documentation, there must be something somewhere that shows the > syntax, yes? > This is probably the best reference for using plot lines. If you can't find what you're looking for there it may not exist... http://orgmode.org/worg/org-tutorials/org-plot.html Cheers -- Eric > > — Michael > > > -- Eric Schulte http://cs.unm.edu/~eschulte/ ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: gnuplot question - "Specify an entire line to be inserted in the Gnuplot script." 2011-07-29 22:52 ` Eric Schulte @ 2011-07-29 23:06 ` Michael C Gilbert 0 siblings, 0 replies; 6+ messages in thread From: Michael C Gilbert @ 2011-07-29 23:06 UTC (permalink / raw) To: emacs-orgmode Mailinglist On Jul 29, 2011, at 3:52 PM, Eric Schulte wrote: >> That means that, in the mean time, if you or anyone has an example of >> how to configure this using the line: formatting, it would still be >> useful to me and I would still be grateful. I just have something >> small I need to produce tonight or tomorrow, for doing some simple >> blood pressure tracking. I have everything working except a couple of >> reference lines running across the plot. I'm figuring since it's in >> the documentation, there must be something somewhere that shows the >> syntax, yes? > > This is probably the best reference for using plot lines. If you can't > find what you're looking for there it may not exist... > http://orgmode.org/worg/org-tutorials/org-plot.html First place I looked, after the manual. It reproduces the entry about the use if the "line" option, but that's it. Anyone on the list used this option? Or competent enough with the code to look at what the syntax is likely to be? Sorry for the lame question, since there is clearly a better way to do this down the road. — M ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: gnuplot question - "Specify an entire line to be inserted in the Gnuplot script." 2011-07-29 22:48 ` Michael C Gilbert 2011-07-29 22:52 ` Eric Schulte @ 2011-07-29 23:41 ` Nick Dokos 1 sibling, 0 replies; 6+ messages in thread From: Nick Dokos @ 2011-07-29 23:41 UTC (permalink / raw) To: Michael C Gilbert; +Cc: nicholas.dokos, emacs-orgmode Mailinglist Michael C Gilbert <mcg@gilbert.org> wrote: > > On Jul 29, 2011, at 12:52 PM, Eric Schulte wrote: > > > I would recommending using a gnuplot code block rather than a plot line, > > and passing your data to the code block using a variable. Code blocks > > give you much more direct access to gnuplot, which I find generally > > makes gnuplot learning/debugging much easier. > > > > see http://orgmode.org/manual/Working-With-Source-Code.html > > <snip> > > Thank you, Eric. You're generous with your time and you're absolutely > correct. This is the direction I will go. There's no doubt that this > seems the right way to go for anything sophisticated. And like most > solutions, it will then end up my standard approach. However, it also > means I will put this off for a little while until I'm ready to do it > right. Maybe just a few days, but... > > That means that, in the mean time, if you or anyone has an example of > how to configure this using the line: formatting, it would still be > useful to me and I would still be grateful. I just have something > small I need to produce tonight or tomorrow, for doing some simple > blood pressure tracking. I have everything working except a couple of > reference lines running across the plot. I'm figuring since it's in > the documentation, there must be something somewhere that shows the > syntax, yes? > The syntax is not the problem - here is an example that adds a couple of lines to the script, so the graph line comes out gold (as you can see, I just cribbed from Eric and modified the PLOT line :-) --8<---------------cut here---------------start------------->8--- * Date series plot From Eric Schulte M-x org-plot/gnuplot somewhere above or in the table. #+PLOT: title:"Weight" ind:1 deps:(2) type:2d with:linespoints set:"xdata time" set:"yrange [90:]" line:"set style line 1 lw 2 lc rgb 'gold'" line:"set style increment user" | Date | Kg | |------------------+------| | <2010-02-21 Sun> | 95.0 | | <2010-02-22 Mon> | 93.0 | | <2010-02-23 Tue> | 92.0 | | <2010-02-24 Wed> | 91.5 | | <2010-02-25 Thu> | 91.0 | | <2010-02-26 Fri> | 92.0 | --8<---------------cut here---------------end--------------->8--- The point is that the line: options just get added willy-nilly into the script that org-plot/gnuplot prepares, which it then passes to gnuplot for plotting. But it adds them before the final plot command and there's the rub. Maybe there is another way to do it, but what I thought of when I read you wanted "reference lines" were a couple of horizontal lines. That is easily done with gnuplot: just plot constant functions. For example replot f(x)=92.5, f(x) will plot a horizontal straight line with y-coordinate 92.5, through the middle of the previous graph, and the "replot" says add it to the previous graph. The rub is that it has to come *after* the plot command for the table and I know of no way to force that to happen through org-plot. OTOH, with babel, it's easy as \pi: --8<---------------cut here---------------start------------->8--- * Using org-babel for more control From Eric Schulte #+TBLNAME: my-table | Date | Kg | |------------+------| | 2010-02-21 | 95.0 | | 2010-02-22 | 93.0 | | 2010-02-23 | 92.0 | | 2010-02-24 | 91.5 | | 2010-02-25 | 91.0 | | 2010-02-26 | 92.0 | #+begin_src gnuplot :var data=my-table set xdata time set timefmt '%Y-%m-%d' set yrange [90:] plot data using 1:2 with linespoints title 'Kg' replot f(x)=92.5, f(x) #+end_src --8<---------------cut here---------------end--------------->8--- Nick ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2011-07-29 23:42 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2011-07-29 19:29 gnuplot question - "Specify an entire line to be inserted in the Gnuplot script." Michael Gilbert 2011-07-29 19:52 ` Eric Schulte 2011-07-29 22:48 ` Michael C Gilbert 2011-07-29 22:52 ` Eric Schulte 2011-07-29 23:06 ` Michael C Gilbert 2011-07-29 23:41 ` Nick Dokos
Code repositories for project(s) associated with this external index https://git.savannah.gnu.org/cgit/emacs.git https://git.savannah.gnu.org/cgit/emacs/org-mode.git This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.