|
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
|