You are not logged in.

#1 2011-08-25 19:40:11

Declan
Member
Registered: 2009-02-06
Posts: 91

How can I make gnuplot load files by right clicking in openbox?

Hi guys, I plot a ton of stuff and sometimes the filenames can be very long with lots of spaces. Oftentimes I just want to take a quick glance at the output in gnuplot, but typing in the title by hand would be a major PITA (gnuplot doesn't autocomplete filenames with spaces). So I'd like to be able to select a file (or files), then right click and have an option "Plot with gnuplot", where it would just plot them with the default values, in wxt and such.

I know how to add things to the menus, but I don't know where I'd go from there...can anyone point me in the right direction?

Thanks!

Offline

#2 2011-08-26 02:22:18

rockin turtle
Member
From: Montana, USA
Registered: 2009-10-22
Posts: 227

Re: How can I make gnuplot load files by right clicking in openbox?

I'm not sure I understand your question. You say you would like to "select a file", but you don't say what you mean by this.  Are you selecting from within gnuplot? from a mouse in a file manager? from a shell prompt?  Are the files you wish to plot all located in a single directory, or are they scattered about in several directories?

I haven't used gnuplot a lot, I seem to remember that I would do something like

$ gnuplot -p foo

where foo was a file containing gnuplot instructions.  If foo contained only the ploting instructions (no data) then it would either reference a different file that contained the data or '-' (the data would be piped to stdin).  So when you say you would like to "Plot with gnuplot", are you talking about a file that contains both the ploting instructions and the data, or do you have one or more common 'instructions' file to which you then pipe different data sets?

I've never used openbox (I am about to, though), but I understand it has a very nice dynamic menu facility which I believe would be able to do for you what you want, but I would need more information to help you with this.

Offline

#3 2011-08-26 19:38:14

Declan
Member
Registered: 2009-02-06
Posts: 91

Re: How can I make gnuplot load files by right clicking in openbox?

rockin turtle wrote:

I'm not sure I understand your question. You say you would like to "select a file", but you don't say what you mean by this.  Are you selecting from within gnuplot? from a mouse in a file manager? from a shell prompt?  Are the files you wish to plot all located in a single directory, or are they scattered about in several directories?

I haven't used gnuplot a lot, I seem to remember that I would do something like

$ gnuplot -p foo

where foo was a file containing gnuplot instructions.  If foo contained only the ploting instructions (no data) then it would either reference a different file that contained the data or '-' (the data would be piped to stdin).  So when you say you would like to "Plot with gnuplot", are you talking about a file that contains both the ploting instructions and the data, or do you have one or more common 'instructions' file to which you then pipe different data sets?

I've never used openbox (I am about to, though), but I understand it has a very nice dynamic menu facility which I believe would be able to do for you what you want, but I would need more information to help you with this.

Yeah, sorry, should have clarified. I want to select the files with my mouse, in the file manager (I use Rox). Maybe they'll be scattered around several directories. They won't be instruction files, they'll just be pure data, in the form of a column for each variable.

So, if I have file a.dat, b.dat, etc., it'll plot 1:2 from a.dat on the same graph as 1:2 from b.dat.

So I won't have an instruction file for this, because it'll be just done at the moment. Unless there's a way I could quickly produce a temporary instruction file which would then run...hmmm ,that could work. I'd need my script to:

-Select files
-Have my script create an instruction file (.tempPlot.plot)
-Write the commands and names of files I selected to this file
-Save it
-Run gnuplot with this instruction file
-Delete the file after exit

Could I do all this with bash?

Thanks!

Edit: Someone pointed out to me that this is really more a matter of my file manager than openbox. I use Rox. But I'm having a lot of trouble finding how I can add a menu option to its right click menu, in the documentation: http://rox.sourceforge.net/Manual/Manual/Manual.html

Last edited by Declan (2011-08-26 20:34:21)

Offline

#4 2011-08-26 22:05:08

rockin turtle
Member
From: Montana, USA
Registered: 2009-10-22
Posts: 227

Re: How can I make gnuplot load files by right clicking in openbox?

I really can't help you with Rox, as I have never used it nor read the documentation.

It would be simple to do as a bash script, especially if you have bash-completion installed.

#!/bin/bash

xr="set xrange [-10,10]"
yr="set xrange [-10,10]"
tsize="set term wxt size 11,11"
plot1="plot \"$1\" using 1:2"
plot2="plot \"$2\" using 1:2"

gnuplot -p -e "$xr; $yr; $tsize; $plot1; $plot2"

then just run the script (call it plot)

$ ./plot a.dat b.dat

or put the script in your path

$ plot a.dat b.dat

Offline

Board footer

Powered by FluxBB