From: Nick Dokos <nicholas.dokos@hp.com>
To: Michael C Gilbert <mcg@gilbert.org>
Cc: nicholas.dokos@hp.com, emacs-orgmode Mailinglist <emacs-orgmode@gnu.org>
Subject: Re: gnuplot question - "Specify an entire line to be inserted in the Gnuplot script."
Date: Fri, 29 Jul 2011 19:41:54 -0400 [thread overview]
Message-ID: <7421.1311982914@alphaville.americas.hpqcorp.net> (raw)
In-Reply-To: Message from Michael C Gilbert <mcg@gilbert.org> of "Fri, 29 Jul 2011 15:48:00 PDT." <7C3F7CA1-A957-4D18-9EEB-B2E6DA157B42@gilbert.org>
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
prev parent reply other threads:[~2011-07-29 23:42 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7421.1311982914@alphaville.americas.hpqcorp.net \
--to=nicholas.dokos@hp.com \
--cc=emacs-orgmode@gnu.org \
--cc=mcg@gilbert.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.