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


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

Re: Piecewise function in gnuplot?

From Karl Ratzsch <mail.kfr@gmx.net>
Newsgroups comp.graphics.apps.gnuplot
Subject Re: Piecewise function in gnuplot?
Date 2017-11-09 08:13 +0100
Organization solani.org
Message-ID <ou0v6i$8ct$1@solani.org> (permalink)
References <16c3d30b-38eb-4028-9a9a-4a30b869be1a@googlegroups.com> <otveef$95j$1@solani.org> <9ee6918b-c4e2-45a0-8f35-d069da4290e7@googlegroups.com>

Show all headers | View raw


Am 08.11.2017 um 20:58 schrieb Lawrence Bottorff:
> No, actually, I need the lines depicting the individual sections to be disjoint (not connected like in the gnuplot examples) and showing the filled or empty dots on the ends of the disjoint lines.
> 

Ah. You need to plot the points and lines individually.

-------------
$full << EOD
-5
5
EOD

$empty << EOD
0
EOD

plot sample [-5:0] x-1 lc 8, \
     [0:5] x+1 lc 8,\
     $full pt 7 lc 8,\
     $empty pt 6 lc 8
----------

There's no automagic for that in gnuplot, except that gnuplot only
connects consecutive datapoints by a line IF there is no invalid
datapoint in between (see "help datapoint missing" for complete
description).

If you carefully control the sampling and do

set xr [-10:10]
set sample 21 # !!!!
plot x<0 ? -1 : x>0 ? 1 : NaN

gnuplot notices that zero is undefined and breaks the line.

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


Thread

Piecewise function in gnuplot? Lawrence Bottorff <borgauf@gmail.com> - 2017-11-08 05:21 -0800
  Re: Piecewise function in gnuplot? Karl Ratzsch <mail.kfr@gmx.net> - 2017-11-08 18:21 +0100
    Re: Piecewise function in gnuplot? Lawrence Bottorff <borgauf@gmail.com> - 2017-11-08 11:58 -0800
      Re: Piecewise function in gnuplot? Karl Ratzsch <mail.kfr@gmx.net> - 2017-11-09 08:13 +0100

csiph-web