Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.graphics.apps.gnuplot > #785
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail |
|---|---|
| From | Ingo Thies <ingo.thies@gmx.de> |
| Newsgroups | comp.graphics.apps.gnuplot |
| Subject | Re: plot a function using solid line between [-pi, pi] while dashed line extended a little on both side |
| Date | Mon, 26 Dec 2011 09:36:13 +0100 |
| Lines | 33 |
| Message-ID | <9lqpvsFu83U1@mid.individual.net> (permalink) |
| References | <b3b49e0f-e0af-49a3-8940-7697491a1ef3@37g2000prc.googlegroups.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-Trace | individual.net ySIjKnuouF0NQe0hCTFClgLe9RAngDPWzlGPwfwqWuI4KbWPWj |
| Cancel-Lock | sha1:M6aKprUxBUNjHZ85tZi6wFgcVJo= |
| User-Agent | Mozilla/5.0 (Macintosh; Intel Mac OS X 10.5; rv:9.0) Gecko/20111220 Thunderbird/9.0 |
| In-Reply-To | <b3b49e0f-e0af-49a3-8940-7697491a1ef3@37g2000prc.googlegroups.com> |
| Xref | x330-a1.tempe.blueboxinc.net comp.graphics.apps.gnuplot:785 |
Show key headers only | View raw
Hello Steven and happy Christmas! > I need to draw a -sinx function using solid line between [-pi, pi] > while dashed line extended. The dashed line to show that the > function will be extended infinitely on both side, not stopped from - > pi to pi. I am not up to date whether gnuplot now has an intrinsic option for that. However, the standard solution has ever been to define two truncated functions. Let sin(x) be your function to be plotted. Then define fin(x) = abs(x)<=pi ? sin(x) : 1/0 fout(x)= abs(x)>pi ? sin(x) : 1/0 For the full description, see the gnuplot.pdf and look for "ternary" in the "Operators" section (p.29 in my version, but varies a little due to updates of the document). The term 1/0 gives an unplottable value which ist simply skipped by gnuplot. Nowadays, also NaN (not a number) can be used directly. Now plot as follows (I skipped your other definitions here): plot fin(x) w l lt 1, fout(x) w l lt 2 Instead of linetypes 1 and 2 you can, of course, also define linestyles, one with solid (linetype 1), and one with dashed (lt 2) shape. If all plots are the same colour and the dashed line is not wider than the solid one (i.e. it will be hidden by the solid line), you can skip the definition of fout entirely and use your sin(x) function directly. HTH, Ingo
Back to comp.graphics.apps.gnuplot | Previous | Next — Previous in thread | Next in thread | Find similar
plot a function using solid line between [-pi, pi] while dashed line extended a little on both side Steven Du <stevendduu@gmail.com> - 2011-12-25 21:36 -0800
Re: plot a function using solid line between [-pi, pi] while dashed line extended a little on both side Ingo Thies <ingo.thies@gmx.de> - 2011-12-26 09:36 +0100
Re: plot a function using solid line between [-pi, pi] while dashed line extended a little on both side Steven Du <stevendduu@gmail.com> - 2011-12-26 22:09 -0800
csiph-web