# Gnuplot with ruby - unset variable?

**URL:** <https://www.ruby-forum.com/t/gnuplot-with-ruby-unset-variable/142391>\
**Category:** Ruby\
**Created:** [July 7, 2008, 3:10pm UTC](https://www.ruby-forum.com/t/gnuplot-with-ruby-unset-variable/142391 "2008-07-07T15:10:17Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![m3tr0g33k](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/cab0a1/32.png) [@m3tr0g33k](https://www.ruby-forum.com/u/m3tr0g33k)\
**Post date:** [July 7, 2008, 3:10pm UTC](https://www.ruby-forum.com/t/gnuplot-with-ruby-unset-variable/142391/1 "2008-07-07T15:10:17Z")

</div>

Hi all,

Seems like rgplot2.2 is inactive - is this correct?  
I am used to gnuplot, so I went to it first when starting with Ruby.  
One problem - trying to replicate ‘unset border’

All of the ‘set’ actions in Gnuplot::Plot are listed individually.  
This means that to do 'set border ’ you do plot.border “”.

But to do ‘unset border’ you can’t do plot.border “unset” because you  
get an error from gnuplot like ‘set unset border ERROR’. This seems  
right for the way rgplot works, but how do you do ‘unset border’?

Should I give up and use R :?

Thanks in advance, if anyone can help

m3tr0g33k

---

<div class="post-metadata">

**Author:** ![m3tr0g33k](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/cab0a1/32.png) [@m3tr0g33k](https://www.ruby-forum.com/u/m3tr0g33k)\
**Post date:** [July 7, 2008, 4:40pm UTC](https://www.ruby-forum.com/t/gnuplot-with-ruby-unset-variable/142391/2 "2008-07-07T16:40:42Z")

</div>

Hi —

> But to do ‘unset border’ you can’t do plot.border “unset” because you  
> get an error from gnuplot like ‘set unset border ERROR’. This seems  
> right for the way rgplot works, but how do you do ‘unset border’?

It seems that earlier versions of Gnuplot used to have the command  
set no  
instead of  
unset ,

and rgplot expects this … and hasn’t been updated for a while.  
When I enter “set noborder” in my Gnuplot 4.2 at the command line, it  
complains about a deprecated  
syntax, but nevertheless removes the border.

> Should I give up and use R :?

Maybe you’ll also have a look at tioga ([rubyforge.org/projects/tioga/](http://rubyforge.org/projects/tioga/))  
for an alternative  
to Gnuplot. Should you know how to compile it in Windows, please leave a  
note.

Best regards,

Axel

---

<div class="post-metadata">

**Author:** ![m3tr0g33k](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/cab0a1/32.png) [@m3tr0g33k](https://www.ruby-forum.com/u/m3tr0g33k)\
**Post date:** [July 7, 2008, 6:34pm UTC](https://www.ruby-forum.com/t/gnuplot-with-ruby-unset-variable/142391/3 "2008-07-07T18:34:32Z")

</div>

Joel VanderWerf wrote:

> No docs, but there are  
> some examples[3] that should explain how to use it.

Well, minimal docs now.

---

<div class="post-metadata">

**Author:** ![m3tr0g33k](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/cab0a1/32.png) [@m3tr0g33k](https://www.ruby-forum.com/u/m3tr0g33k)\
**Post date:** [July 7, 2008, 6:21pm UTC](https://www.ruby-forum.com/t/gnuplot-with-ruby-unset-variable/142391/4 "2008-07-07T18:21:38Z")

</div>

M3tr0 G33k wrote:

> But to do ‘unset border’ you can’t do plot.border “unset” because you  
> get an error from gnuplot like ‘set unset border ERROR’. This seems  
> right for the way rgplot works, but how do you do ‘unset border’?
> 
> Should I give up and use R :?
> 
> Thanks in advance, if anyone can help
> 
> m3tr0g33k

Hello, Mr. G33k,

I use an interface[1] that doesn’t attempt to turn gnuplot commands into  
objects and methods–you just pipe commands to gnuplot. But it does  
solve a number of other problems, like passing your data via tempfiles  
to gnuplot and persisting windows, both Windows and X11. (Persisting  
windows on X11 is kinda tricky[2] for gnuplot version \<4.3–if you do it  
wrong you end up with zombie processes, and the -persist option is not  
acceptable since it disables mouse interaction.) No docs, but there are  
some examples[3] that should explain how to use it.

[1] [Science](http://redshift.sourceforge.net/sci/)

[2] [http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/293549](http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/293549)

[3] Simple example:

require ‘sci/plot’  
include Plot::PlotUtils

sin\_graph, cos\_graph = [], []

0.step(2\*Math::PI, 0.01) do |x|  
sin\_graph \<\< [x, Math::sin(x)]  
cos\_graph \<\< [x, Math::cos(x)]  
end

plot = gnuplot do |plot|  
plot.command %{set title “Plot example”}  
plot.command %{set xlabel “x”}  
plot.command %{set ylabel “y”}  
plot.add sin\_graph, %{title “sin(x)” with lines}  
plot.add cos\_graph, %{title “cos(x)” with lines}  
plot.add “sin(x) + 1”, %{title “sin(x) + 1”}  
end

---

<div class="post-metadata">

**Author:** ![m3tr0g33k](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/cab0a1/32.png) [@m3tr0g33k](https://www.ruby-forum.com/u/m3tr0g33k)\
**Post date:** [July 7, 2008, 7:54pm UTC](https://www.ruby-forum.com/t/gnuplot-with-ruby-unset-variable/142391/5 "2008-07-07T19:54:11Z")

</div>

Thanks for your reply, Joel VanderWerf.

I am mainly getting data from csv files and plotting to ps images.  
Thankfully window persistence doesn’t bother me (yet).

Appreciate your input,

m3tr0g33k

---

<div class="post-metadata">

**Author:** ![m3tr0g33k](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/cab0a1/32.png) [@m3tr0g33k](https://www.ruby-forum.com/u/m3tr0g33k)\
**Post date:** [July 7, 2008, 8:58pm UTC](https://www.ruby-forum.com/t/gnuplot-with-ruby-unset-variable/142391/6 "2008-07-07T20:58:00Z")

</div>

M3tr0 G33k wrote:

> Thanks for your reply, Joel VanderWerf.
> 
> I am mainly getting data from csv files and plotting to ps images.  
> Thankfully window persistence doesn’t bother me (yet).

Ok. If you ever write a GUI that puts up graph windows that the user can  
control and dismiss, then my lib may be useful.

---

<div class="post-metadata">

**Author:** ![m3tr0g33k](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/cab0a1/32.png) [@m3tr0g33k](https://www.ruby-forum.com/u/m3tr0g33k)\
**Post date:** [July 7, 2008, 7:49pm UTC](https://www.ruby-forum.com/t/gnuplot-with-ruby-unset-variable/142391/7 "2008-07-07T19:49:28Z")

</div>

Axel E. wrote:

> Best regards,
> 
> Axel

Thanks!  
Works a treat.

---

<div class="post-metadata">

**Author:** ![m3tr0g33k](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/cab0a1/32.png) [@m3tr0g33k](https://www.ruby-forum.com/u/m3tr0g33k)\
**Post date:** [July 17, 2008, 1:41am UTC](https://www.ruby-forum.com/t/gnuplot-with-ruby-unset-variable/142391/8 "2008-07-17T01:41:04Z")

</div>

M3tr0 G33k wrote:

> Hi all,
> 
> Seems like rgplot2.2 is inactive - is this correct?  
> I am used to gnuplot, so I went to it first when starting with Ruby.  
> One problem - trying to replicate ‘unset border’
> 
> All of the ‘set’ actions in Gnuplot::Plot are listed individually.  
> This means that to do 'set border ’ you do plot.border “”.
> 
> But to do ‘unset border’ you can’t do plot.border “unset” because you  
> get an error from gnuplot like ‘set unset border ERROR’. This seems  
> right for the way rgplot works, but how do you do ‘unset border’?
> 
> Should I give up and use R :?
> 
> Thanks in advance, if anyone can help
> 
> m3tr0g33k

FYI (I know this was days ago), but if you want to unset something like  
ytics for example, you would write plot.noytics. If you wanted to unset  
border you would write plot.noborder. Hope that helps.
