1
0
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2025-01-30 20:41:41 +00:00

Plotting: Fix histogram plotting.

William Henney writes:

     The following table works correctly with org-plot
    #+PLOT: title:"org-plot test" ind:1 type:2d with:hist set:"style fill
    solid" set:"yrange [0:]"
     |  Year | a | b |
     |-------+---+---|
     | x2006 | 3 | 1 |
     |  2007 | 1 | 2 |
     |  2008 | 2 | 0 |

     However, if the "x" is removed from the start of all the years, it no
     longer works:

    #+PLOT: title:"org-plot bug" ind:1 type:2d with:hist set:"style fill
    solid" set:"yrange [0:]"
     | Year | a | b |
     |------+---+---|
     | 2006 | 3 | 1 |
     | 2007 | 1 | 2 |
     | 2008 | 2 | 0 |

     From glancing through org-plot.el, it seems as though the problem is
     that the text-ind parameter is false when all the values in the
     "independent variable" column are legal numbers. However, my lisp
     skills are not up to fixing this.

This patch is by Charles Sebold and Eric Schulte fixes the problem.
This commit is contained in:
Carsten Dominik 2009-01-16 19:43:33 +01:00
parent af62bbd44c
commit 1edd9d0cc6
2 changed files with 11 additions and 6 deletions

View File

@ -1,5 +1,8 @@
2009-01-16 Carsten Dominik <carsten.dominik@gmail.com>
* org-plot.el (org-plot/gnuplot): Fix text-ind parameter for
histograms.
* org-colview.el (org-colview-construct-allowed-dates): Better
error catching when a date/time property does not have allowed
values defined.

View File

@ -316,12 +316,14 @@ line directly before or after the table."
(mapcar (lambda (row) (nth ind row)) table)))) 0)
(plist-put params :timeind t)
;; check for text ind column
(if (> (length
(delq 0 (mapcar
(lambda (el)
(if (string-match org-table-number-regexp el)
0 1))
(mapcar (lambda (row) (nth ind row)) table)))) 0)
(if (or (string= (plist-get params :with) "hist")
(> (length
(delq 0 (mapcar
(lambda (el)
(if (string-match org-table-number-regexp el)
0 1))
(mapcar (lambda (row) (nth ind row)) table)))) 0))
(plist-put params :textind t)))))
;; write script
(with-temp-buffer