* org-plot histogram bug when the x-axis labels could be interpreted as numbers
@ 2009-01-14 16:49 William Henney
2009-01-14 20:15 ` Charles Sebold
0 siblings, 1 reply; 5+ messages in thread
From: William Henney @ 2009-01-14 16:49 UTC (permalink / raw)
To: emacs-orgmode list
Hi list
* org-plot bug
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.
Cheer
Will
--
Dr William Henney, Centro de Radioastronomía y Astrofísica,
Universidad Nacional Autónoma de México, Campus Morelia
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: org-plot histogram bug when the x-axis labels could be interpreted as numbers
2009-01-14 16:49 org-plot histogram bug when the x-axis labels could be interpreted as numbers William Henney
@ 2009-01-14 20:15 ` Charles Sebold
2009-01-14 21:10 ` Eric Schulte
0 siblings, 1 reply; 5+ messages in thread
From: Charles Sebold @ 2009-01-14 20:15 UTC (permalink / raw)
To: emacs-orgmode
On 14 Jan 2009, William Henney wrote:
> 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 may fix that problem, but I don't know that it doesn't produce a
nest of bigger ones. Eric should look at this first. This seems to me
to be useful enough when producing histograms.
diff --git a/lisp/org-plot.el b/lisp/org-plot.el
index 7efd84a..01a8360 100644
--- a/lisp/org-plot.el
+++ b/lisp/org-plot.el
@@ -246,10 +246,12 @@ NUM-COLS controls the number of columns plotted in a 2-d plot."
(setf plot-lines
(cons
(format plot-str data-file
- (or (and (not text-ind) ind
+ (or (and (not (string= with "hist"))
+ (not text-ind) ind
(> ind 0) (format "%d:" ind)) "")
(+ 1 col)
- (if text-ind (format ":xticlabel(%d)" ind) "")
+ (if (or (string= with "hist") text-ind)
+ (format ":xticlabel(%d)" ind) "")
with
(or (nth col col-labels) (format "%d" (+ 1 col))))
plot-lines)))))
--
Charles Sebold 14th of January, 2009
GNU Emacs 22.3.1 (i386-mingw-nt5.1.2600) | Gnus v5.11 | org-mode 6.17trans
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: org-plot histogram bug when the x-axis labels could be interpreted as numbers
2009-01-14 20:15 ` Charles Sebold
@ 2009-01-14 21:10 ` Eric Schulte
2009-01-15 0:18 ` Charles Sebold
2009-01-17 8:01 ` Carsten Dominik
0 siblings, 2 replies; 5+ messages in thread
From: Eric Schulte @ 2009-01-14 21:10 UTC (permalink / raw)
To: emacs-orgmode
Charles Sebold <csebold@gmail.com> writes:
> On 14 Jan 2009, William Henney wrote:
>
>> 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 may fix that problem, but I don't know that it doesn't produce a
> nest of bigger ones. Eric should look at this first. This seems to me
> to be useful enough when producing histograms.
>
Hi,
I believe that forcing text-ind to be true when the plot type is 'hist'
is a safe enough maneuver (especially plotting with hist seems to fail
if text-ind is not true).
I would recommend this patch. It's the same idea as Charles' only
implemented in a different place.
Thanks -- Eric
diff --git a/lisp/org-plot.el b/lisp/org-plot.el
index 7efd84a..1792d50 100644
--- a/lisp/org-plot.el
+++ b/lisp/org-plot.el
@@ -316,12 +316,13 @@ 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
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: org-plot histogram bug when the x-axis labels could be interpreted as numbers
2009-01-14 21:10 ` Eric Schulte
@ 2009-01-15 0:18 ` Charles Sebold
2009-01-17 8:01 ` Carsten Dominik
1 sibling, 0 replies; 5+ messages in thread
From: Charles Sebold @ 2009-01-15 0:18 UTC (permalink / raw)
To: Eric Schulte; +Cc: emacs-orgmode
On Wed, 14 Jan 2009, Eric Schulte wrote:
> I believe that forcing text-ind to be true when the plot type is
> 'hist' is a safe enough maneuver (especially plotting with hist seems
> to fail if text-ind is not true).
>
> I would recommend this patch. It's the same idea as Charles' only
> implemented in a different place.
Thanks, I had a feeling I was making it more complicated than it had to
be.
--
Charles Sebold
http://merbc.invigorated.org/
http://triablogue.blogspot.com/
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: org-plot histogram bug when the x-axis labels could be interpreted as numbers
2009-01-14 21:10 ` Eric Schulte
2009-01-15 0:18 ` Charles Sebold
@ 2009-01-17 8:01 ` Carsten Dominik
1 sibling, 0 replies; 5+ messages in thread
From: Carsten Dominik @ 2009-01-17 8:01 UTC (permalink / raw)
To: Eric Schulte; +Cc: emacs-orgmode
Applied, thanks.
- Carsten
On Jan 14, 2009, at 10:10 PM, Eric Schulte wrote:
> Charles Sebold <csebold@gmail.com> writes:
>
>> On 14 Jan 2009, William Henney wrote:
>>
>>> 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 may fix that problem, but I don't know that it doesn't produce a
>> nest of bigger ones. Eric should look at this first. This seems
>> to me
>> to be useful enough when producing histograms.
>>
>
> Hi,
>
> I believe that forcing text-ind to be true when the plot type is
> 'hist'
> is a safe enough maneuver (especially plotting with hist seems to fail
> if text-ind is not true).
>
> I would recommend this patch. It's the same idea as Charles' only
> implemented in a different place.
>
> Thanks -- Eric
>
> diff --git a/lisp/org-plot.el b/lisp/org-plot.el
> index 7efd84a..1792d50 100644
> --- a/lisp/org-plot.el
> +++ b/lisp/org-plot.el
> @@ -316,12 +316,13 @@ 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
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Remember: use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2009-01-17 8:09 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-01-14 16:49 org-plot histogram bug when the x-axis labels could be interpreted as numbers William Henney
2009-01-14 20:15 ` Charles Sebold
2009-01-14 21:10 ` Eric Schulte
2009-01-15 0:18 ` Charles Sebold
2009-01-17 8:01 ` Carsten Dominik
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).