From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nick Dokos Subject: Re: Trying to get chart from table working Date: Mon, 02 Oct 2017 11:12:18 -0400 Message-ID: <877ewdinxp.fsf@alphaville.usersys.redhat.com> References: <951a16f3-142b-9a46-d205-e75e93b46fe9@pfdstudio.com> <87efqp8sob.fsf@pinto.chemeng.ucl.ac.uk> <1506699746.1209685.1122625320.2C7619C2@webmail.messagingengine.com> <1506699975.1210299.1122633688.70058F8C@webmail.messagingengine.com> <1506720729.1291151.1122958984.5896B03B@webmail.messagingengine.com> <871smoxqrb.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:35211) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dz2Oc-0005LT-Tx for emacs-orgmode@gnu.org; Mon, 02 Oct 2017 11:12:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dz2OX-000832-Uu for emacs-orgmode@gnu.org; Mon, 02 Oct 2017 11:12:38 -0400 Received: from [195.159.176.226] (port=57243 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dz2OX-00082F-O7 for emacs-orgmode@gnu.org; Mon, 02 Oct 2017 11:12:33 -0400 Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1dz2OL-0006D3-6x for emacs-orgmode@gnu.org; Mon, 02 Oct 2017 17:12:21 +0200 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: emacs-orgmode@gnu.org Eric S Fraga writes: > On Friday, 29 Sep 2017 at 17:32, Peter Davis wrote: >> I'm sorry to belabor this, but I could use some help. I'd be willing to >> pay a modest consulting fee, but I'm trying to solve a problem in a >> timely way, as it would help me with healthcare decisions. >> >> Basically, I want to plot a time series graph showing my PSA (prostate >> specific antigen) over time. The PSA is measured at irregular intervals, >> and has been for over 4 years (and hopefully will continue for many more >> years.) That should be a simple enough graph. I've already got a >> javascript d3 example that does this, but I'd like to embed it in a >> document, and to be able to generate PDF. > > This part is relatively straightforward. Using your data example, you > can do the following: > > * table > > #+name: measurements > | Date | PSA | | > > |------------+-----+---------| > | 2017-08-11 | 185 | | > | 2017-08-21 | | #ffdd99 | > | 2017-09-19 | 854 | #ffdd99 | > > #+begin_src gnuplot :var data=measurements :file timeseries.pdf :results file > set xdata time > set timefmt "%Y-%m-%d" > set xrange ["2017-08-01":"2017-10-01"] > unset key > plot data using 1:2 with histeps > #+end_src > > #+results: > [[file:timeseries.pdf]] > FWIW, this is what I get in the *gnuplot* buffer when I C-c C-c on the code block: ,---- | | G N U P L O T | Version 5.0 patchlevel 3 last modified 2016-02-21 | | Copyright (C) 1986-1993, 1998, 2004, 2007-2016 | Thomas Williams, Colin Kelley and many others | | gnuplot home: http://www.gnuplot.info | faq, bugs, etc: type "help FAQ" | immediate help: type "help" (plot window: hit 'h') | | Terminal type set to 'qt' | gnuplot> data = "/tmp/babel-3079d_T/gnuplot-3079Hwc" | gnuplot> set term pdf | Terminal type set to 'pdfcairo' | Options are ' transparent enhanced fontscale 0.5 size 5.00in, 3.00in ' | gnuplot> set output "timeseries.pdf" | gnuplot> set xdata time | gnuplot> set timefmt "%Y-%m-%d" | gnuplot> set xrange ["2017-08-01":"2017-10-01"] | gnuplot> unset key | gnuplot> plot data using 1:2 with histeps | warning: Skipping data file with no valid points | ^ | all points y value undefined! `---- -- Nick