Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.graphics.apps.gnuplot > #3996

Re: space between sign and digit

Path csiph.com!feeder.erje.net!1.eu.feeder.erje.net!weretis.net!feeder4.news.weretis.net!feeder5.news.weretis.net!news.solani.org!.POSTED!not-for-mail
From Karl Ratzsch <mail.kfr@gmx.net>
Newsgroups comp.graphics.apps.gnuplot
Subject Re: space between sign and digit
Date Wed, 11 Jul 2018 10:00:42 +0200
Organization solani.org
Lines 21
Message-ID <pi4dfb$rk4$1@solani.org> (permalink)
References <pi49eq$a7$1@dont-email.me>
Mime-Version 1.0
Content-Type text/plain; charset=utf-8
Content-Transfer-Encoding 8bit
X-Trace solani.org 1531296043 28292 127.0.0.43 (11 Jul 2018 08:00:43 GMT)
X-Complaints-To abuse@news.solani.org
NNTP-Posting-Date Wed, 11 Jul 2018 08:00:43 +0000 (UTC)
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1
X-User-ID eJwNxMERACEIA8CWDhOClMOA9l+Ct491yNRBuejX79kalJiWmcYozESs/VVTc3Eagez1b0PUAw2JEIE=
In-Reply-To <pi49eq$a7$1@dont-email.me>
Content-Language en-GB
Cancel-Lock sha1:yGRs8xYnWoX7qGUsLD/GTkvtVo0=
Xref csiph.com comp.graphics.apps.gnuplot:3996

Show key headers only | View raw


Am 11.07.2018 um 08:52 schrieb Jörg Buchholz:
> Hello,
> 
> I would like to print a function in the key like this:
> 
> f11(x) = -2.56·x - 103.63
> 
> I use the following code in the plot command for that:
> 
> f11(x) lt 2 lw 4 dt 4 t sprintf("f11(x) =%6.2f·x%+7.2f",a,b11)
> 
> That means, that I use the sign from the format specifier as plus sign
> or minus sing in the printed function. But than I don't have a space in
> front of the second number. The second number can be positive or negative.

sprintf() can't add an extra space in there i think. Following uses the
ternary operator on b11 to check which sign character is needed

plot f11(x) lt 2 lw 4 dt 4 t \
  sprintf("f11(x) =%.2f·x %s %.2f",a,b11<0?"-":"+",abs(b11))

Back to comp.graphics.apps.gnuplot | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

space between sign and digit Jörg Buchholz <bookwood4new@freenet.de> - 2018-07-11 08:52 +0200
  Re: space between sign and digit Karl Ratzsch <mail.kfr@gmx.net> - 2018-07-11 10:00 +0200
    Re: space between sign and digit Jörg Buchholz <bookwood4new@freenet.de> - 2018-07-11 14:16 +0200
      Re: space between sign and digit Karl Ratzsch <mail.kfr@gmx.net> - 2018-07-11 15:16 +0200
        Re: space between sign and digit Jörg Buchholz <bookwood4new@freenet.de> - 2018-07-12 07:36 +0200
          Re: space between sign and digit Karl Ratzsch <mail.kfr@gmx.net> - 2018-07-12 20:42 +0200
  Re: space between sign and digit Hans-Bernhard Bröker <HBBroeker@t-online.de> - 2018-07-11 20:06 +0200
    Re: space between sign and digit Karl Ratzsch <mail.kfr@gmx.net> - 2018-07-12 06:53 +0200
    Re: space between sign and digit Jörg Buchholz <bookwood4new@freenet.de> - 2018-07-12 07:21 +0200

csiph-web