|
From: Maurizio T. <mau...@ou...> - 2015-01-27 09:55:17
|
Hi to everybody,
Yesterday I posted a question on StackOverflow about the possibility to
use the mathematical minus sign for negative numbers for tick labels in
Gnuplot instead of the hyphen. (This is a request I got from the referee of
a paper I've just submitted.)
Although I have never hacked Gnuplot, I am fluent with C/C++ and would like
to try to write a patch that implements this feature. I would like to ask
you which would be the best way to do this:
1. Implement a pair of commands ("set hyphenminus" / "unset hyphenminus")
which change this setting globally, i.e., on the X/Y/X2/Y2 axes.
2. Implement a new formatting sequence, like "%h", which takes care of using
the correct character.
My preference goes to the first option (if one cares for typographical
correctness, chances are that it wants it on every axis.). Moreover, I would
like to make the mathematical minus the default, and leave the possibility
to use the hyphen only as a way to retain backwards compatibility (this is
what Matplotlib does).
What do you think? Do you have suggestions about how to properly code this?
Maurizio.
|
|
From: Ethan A M. <sf...@us...> - 2015-01-27 23:32:17
|
On Tuesday, 27 January, 2015 09:45:35 Maurizio Tomasi wrote:
> Hi to everybody,
>
> Yesterday I posted a question on StackOverflow about the possibility to
> use the mathematical minus sign for negative numbers for tick labels in
> Gnuplot instead of the hyphen. (This is a request I got from the referee of
> a paper I've just submitted.)
Some gnuplot terminals already do this, or can easily be told to do so.
For example, in the PostScript terminal this is done by specifying the
appropriate glyph in the encoding table that is part of the Prologue.
What terminal type are you using?
Ethan
>
> Although I have never hacked Gnuplot, I am fluent with C/C++ and would like
> to try to write a patch that implements this feature. I would like to ask
> you which would be the best way to do this:
>
> 1. Implement a pair of commands ("set hyphenminus" / "unset hyphenminus")
> which change this setting globally, i.e., on the X/Y/X2/Y2 axes.
>
> 2. Implement a new formatting sequence, like "%h", which takes care of using
> the correct character.
>
> My preference goes to the first option (if one cares for typographical
> correctness, chances are that it wants it on every axis.). Moreover, I would
> like to make the mathematical minus the default, and leave the possibility
> to use the hyphen only as a way to retain backwards compatibility (this is
> what Matplotlib does).
>
> What do you think? Do you have suggestions about how to properly code this?
>
> Maurizio.
>
>
> ------------------------------------------------------------------------------
> Dive into the World of Parallel Programming. The Go Parallel Website,
> sponsored by Intel and developed in partnership with Slashdot Media, is your
> hub for all things parallel software development, from weekly thought
> leadership blogs to news, videos, case studies, tutorials and more. Take a
> look and join the conversation now. http://goparallel.sourceforge.net/
> _______________________________________________
> gnuplot-beta mailing list
> gnu...@li...
> Membership management via: https://lists.sourceforge.net/lists/listinfo/gnuplot-beta |
|
From: Philipp K. J. <ja...@ie...> - 2015-01-27 23:33:21
|
[snip]
> Although I have never hacked Gnuplot, I am fluent with C/C++ and
> would like to try to write a patch that implements this feature. I
> would like to ask you which would be the best way to do this:
>
> 1. Implement a pair of commands ("set hyphenminus" / "unset
> hyphenminus") which change this setting globally, i.e., on the
> X/Y/X2/Y2 axes.
>
> 2. Implement a new formatting sequence, like "%h", which takes care
> of using the correct character.
In that spirit (and sorry for hijacking your
posting): I noticed that the %h and %H conversion
specifiers use an 'x' (letter x) and a '*' (asterisk)
to form numbers like 3.1 x 10^4.
It would be lovely if they used the "multiplication
sign" (U+00d7) and the dot operator (U+22c5 - or
alternatively U+00b7) instead.
I could imagine a general user option for such
situations, eg:
set character minus <character>
set character times <character>
That would also allow an easy fallback for the
situation that the user's installed font does
not supply glyphs for the required "special" chars.
>
> My preference goes to the first option (if one cares for typographical
> correctness, chances are that it wants it on every axis.). Moreover,
> I would like to make the mathematical minus the default, and leave
> the possibility to use the hyphen only as a way to retain backwards
> compatibility (this is what Matplotlib does).
>
> What do you think? Do you have suggestions about how to properly code
> this?
>
> Maurizio.
>
>
> ------------------------------------------------------------------------------
> Dive into the World of Parallel Programming. The Go Parallel Website,
> sponsored by Intel and developed in partnership with Slashdot Media,
> is your hub for all things parallel software development, from weekly
> thought leadership blogs to news, videos, case studies, tutorials and
> more. Take a look and join the conversation now.
> http://goparallel.sourceforge.net/
> _______________________________________________ gnuplot-beta mailing
> list gnu...@li...
> Membership management via:
> https://lists.sourceforge.net/lists/listinfo/gnuplot-beta
|
|
From: Ethan A M. <sf...@us...> - 2015-01-27 23:56:08
|
On Tuesday, 27 January, 2015 15:33:15 Philipp K. Janert wrote: > > [snip] > > In that spirit (and sorry for hijacking your > posting): I noticed that the %h and %H conversion > specifiers use an 'x' (letter x) and a '*' (asterisk) > to form numbers like 3.1 x 10^4. > > It would be lovely if they used the "multiplication > sign" (U+00d7) and the dot operator (U+22c5 - or > alternatively U+00b7) instead. gnuplot does in fact use a multiplication sign (U+00d7) if the encoding permits. That covers almost all linux systems since the default encoding is UTF-8. MSWin encoding CP1252 uses the symbol 0xd7, which I think is the same? I'm not sure what the default encoding is on OSX. The LaTeX terminals use \\times or \\cdot. Ethan |
|
From: Allin C. <cot...@wf...> - 2015-01-28 02:16:21
|
On Tue, 27 Jan 2015, Ethan A Merritt wrote: > On Tuesday, 27 January, 2015 15:33:15 Philipp K. Janert wrote: >> >> [snip] >> >> In that spirit (and sorry for hijacking your >> posting): I noticed that the %h and %H conversion >> specifiers use an 'x' (letter x) and a '*' (asterisk) >> to form numbers like 3.1 x 10^4. >> >> It would be lovely if they used the "multiplication >> sign" (U+00d7) and the dot operator (U+22c5 - or >> alternatively U+00b7) instead. > > gnuplot does in fact use a multiplication sign (U+00d7) > if the encoding permits. That covers almost all linux > systems since the default encoding is UTF-8. MSWin encoding > CP1252 uses the symbol 0xd7, which I think is the same? > I'm not sure what the default encoding is on OSX. OS X uses UTF-8. These days only Windows is the odd man out. -- Allin Cottrell Department of Economics Wake Forest University |
|
From: Philipp K. J. <ja...@ie...> - 2015-01-28 00:35:08
|
On Tue, 27 Jan 2015 15:53:13 -0800 Ethan A Merritt <sf...@us...> wrote: > On Tuesday, 27 January, 2015 15:33:15 Philipp K. Janert wrote: > > > > [snip] > > > > In that spirit (and sorry for hijacking your > > posting): I noticed that the %h and %H conversion > > specifiers use an 'x' (letter x) and a '*' (asterisk) > > to form numbers like 3.1 x 10^4. > > > > It would be lovely if they used the "multiplication > > sign" (U+00d7) and the dot operator (U+22c5 - or > > alternatively U+00b7) instead. > > gnuplot does in fact use a multiplication sign (U+00d7) > if the encoding permits. That covers almost all linux Well, if I do: set t wxt font "Times" plot [:20] exp(x) then the ytic labels look very much like an 'x', not like the multiplication sign. Is this a font problem (substituting 'x' if no glyph for U+00d7 is available)? But I thought that fontconfig will supply another FONT if necessary, but not substitute a different CHARACTER. > systems since the default encoding is UTF-8. MSWin encoding > CP1252 uses the symbol 0xd7, which I think is the same? > I'm not sure what the default encoding is on OSX. > The LaTeX terminals use \\times or \\cdot. > > Ethan > |
|
From: Ethan A M. <sf...@us...> - 2015-01-28 00:56:12
|
On Tuesday, 27 January, 2015 16:35:02 Philipp K. Janert wrote:
> On Tue, 27 Jan 2015 15:53:13 -0800
> Ethan A Merritt <sf...@us...> wrote:
>
> > On Tuesday, 27 January, 2015 15:33:15 Philipp K. Janert wrote:
> > >
> > > [snip]
> > >
> > > In that spirit (and sorry for hijacking your
> > > posting): I noticed that the %h and %H conversion
> > > specifiers use an 'x' (letter x) and a '*' (asterisk)
> > > to form numbers like 3.1 x 10^4.
> > >
> > > It would be lovely if they used the "multiplication
> > > sign" (U+00d7) and the dot operator (U+22c5 - or
> > > alternatively U+00b7) instead.
> >
> > gnuplot does in fact use a multiplication sign (U+00d7)
> > if the encoding permits. That covers almost all linux
>
> Well, if I do:
> set t wxt font "Times"
> plot [:20] exp(x)
> then the ytic labels look very much like an 'x',
> not like the multiplication sign.
I cannot say what your fonts look like.
I suspect if you look closely you will see a difference
after:
set encoding utf8; replot
set encoding iso_8859_1; replot
The relevant source code is in file util.c starting at line 644.
In looking at it now, I see that it would be possible to
pick up several other ISO_8859 encodings as well as UTF8.
I wonder how many systems still default to ISO_8859-{1|2|15}
rather than UTF8.
Ethan
> Is this a font problem (substituting 'x' if
> no glyph for U+00d7 is available)? But I
> thought that fontconfig will supply another
> FONT if necessary, but not substitute a
> different CHARACTER.
>
> > systems since the default encoding is UTF-8. MSWin encoding
> > CP1252 uses the symbol 0xd7, which I think is the same?
> > I'm not sure what the default encoding is on OSX.
> > The LaTeX terminals use \\times or \\cdot.
> >
> > Ethan
> >
|
|
From: Philipp K. J. <ja...@ie...> - 2015-01-28 01:11:53
|
On Tue, 27 Jan 2015 16:54:01 -0800
Ethan A Merritt <sf...@us...> wrote:
I see - this is very interesting:
Upon gnuplot startup:
show encoding
nominal character encoding is default
however LC_CTYPE in current locale is en_US.UTF-8
and tic labels use 'x' chars.
When I explicitly do:
set encoding utf8
then (as you say) the tic labels use the mult sign.
At the same time, I can use Unicode characters
(beyond ASCII) in strings - which led me to believe
that UTF8 encoding was already active.
I am confused, but will put "set encoding utf8"
in my .gnuplot file.
Best,
Ph.
> On Tuesday, 27 January, 2015 16:35:02 Philipp K. Janert wrote:
> > On Tue, 27 Jan 2015 15:53:13 -0800
> > Ethan A Merritt <sf...@us...> wrote:
> >
> > > On Tuesday, 27 January, 2015 15:33:15 Philipp K. Janert wrote:
> > > >
> > > > [snip]
> > > >
> > > > In that spirit (and sorry for hijacking your
> > > > posting): I noticed that the %h and %H conversion
> > > > specifiers use an 'x' (letter x) and a '*' (asterisk)
> > > > to form numbers like 3.1 x 10^4.
> > > >
> > > > It would be lovely if they used the "multiplication
> > > > sign" (U+00d7) and the dot operator (U+22c5 - or
> > > > alternatively U+00b7) instead.
> > >
> > > gnuplot does in fact use a multiplication sign (U+00d7)
> > > if the encoding permits. That covers almost all linux
> >
> > Well, if I do:
> > set t wxt font "Times"
> > plot [:20] exp(x)
> > then the ytic labels look very much like an 'x',
> > not like the multiplication sign.
>
> I cannot say what your fonts look like.
> I suspect if you look closely you will see a difference
> after:
>
> set encoding utf8; replot
> set encoding iso_8859_1; replot
>
> The relevant source code is in file util.c starting at line 644.
>
> In looking at it now, I see that it would be possible to
> pick up several other ISO_8859 encodings as well as UTF8.
> I wonder how many systems still default to ISO_8859-{1|2|15}
> rather than UTF8.
>
> Ethan
>
> > Is this a font problem (substituting 'x' if
> > no glyph for U+00d7 is available)? But I
> > thought that fontconfig will supply another
> > FONT if necessary, but not substitute a
> > different CHARACTER.
> >
> > > systems since the default encoding is UTF-8. MSWin encoding
> > > CP1252 uses the symbol 0xd7, which I think is the same?
> > > I'm not sure what the default encoding is on OSX.
> > > The LaTeX terminals use \\times or \\cdot.
> > >
> > > Ethan
> > >
|
|
From: Mojca M. <moj...@gm...> - 2015-01-28 01:09:30
|
On Tue, Jan 27, 2015 at 10:45 AM, Maurizio Tomasi wrote:
> Hi to everybody,
>
> Yesterday I posted a question on StackOverflow about the possibility to
> use the mathematical minus sign for negative numbers for tick labels in
> Gnuplot instead of the hyphen. (This is a request I got from the referee of
> a paper I've just submitted.)
>
> Although I have never hacked Gnuplot, I am fluent with C/C++ and would like
> to try to write a patch that implements this feature. I would like to ask
> you which would be the best way to do this:
>
> 1. Implement a pair of commands ("set hyphenminus" / "unset hyphenminus")
> which change this setting globally, i.e., on the X/Y/X2/Y2 axes.
>
> 2. Implement a new formatting sequence, like "%h", which takes care of using
> the correct character.
>
> My preference goes to the first option (if one cares for typographical
> correctness, chances are that it wants it on every axis.). Moreover, I would
> like to make the mathematical minus the default, and leave the possibility
> to use the hyphen only as a way to retain backwards compatibility (this is
> what Matplotlib does).
>
> What do you think? Do you have suggestions about how to properly code this?
Quick solution:
If you are using some TeX-based terminal, you could easily use something like
set format x "$%g$"
(or whatever format you require). Then TeX will automatically convert
the hyphen into mathematical minus.
Matplotlib has full control of its output, but gnuplot is more
heterogeneous, so the problem is slightly more difficult.
In my opinion changing to the mathematical minus *by default* might
cause some problems.
Mathematical minus wouldn't work with terminals or fonts that don't
support that character/glyph. In particular, no encoding from the
ISO-8859 standard contains mathematical minus (I didn't check all, so
please excuse me if I'm wrong). I'm not saying that it's completely
impossible to implement this, but one would need to adapt almost every
terminal.
If you invent a new formatting sequence just for the sake of this one
character, we'll end up in an exponential combinatorics problem.
We could have a single highly configurable formatting sequence with
lots of configuration options (whether to use dot or comma for the
decimal separator; whether or not to use the thousands separator and
if so, which one; what to use for multiplication sign; what to use for
minus sign; whether to make sure that all numbers end up with the same
number of decimal places [something that annoys me a lot; usually one
gets 0, 0.5, 1, 1.5, ... instead of 0.0, 0.5, 1.0, 1.5, ...], how to
format the exponent, ...). But inventing a new formatting for every
single option would quickly spoil the game.
Something like "set minussign ..." sounds like the most reasonable
option to me, but please note that I'm not a gnuplot developer, so
this is just my personal opinion.
Mojca
|