boulis / Castalia

An OMNeT-based simulator for low-power wireless networks such as Wireless Sensor Networks and Body Area Networks
80 stars 51 forks source link

CastaliaPlot Issue #3

Open v4r15 opened 10 years ago

v4r15 commented 10 years ago

I got the following error from CastaliaPlot gnuplot> set key title "TXpower,beaconFraction" 1,0.9

     line 0: unknown key option

After some googling I found out that this happens because of changes in gnuplot. It requires an "at" before the coordinates in order to recognize the coordinates. The solution is to modify line 387 of CastaliaPlot. That line looks like this:

if ltitle != "": key += "title \"" + ltitle + "\" "

and you should change it to this:

if ltitle != "": key += "title \"" + ltitle + "\" at "

This worked for me.

My environment is omnetpp 4.4.1, akaroa 2.7.11, castalia downloaded from http://castalia.research.nicta.com.au/index.php/en/download (which I assume it is the latest version, even though the version file within says that is version 3.0). The gnuplot version is 4.4 patch 3; this is the version that comes with my ubuntu 12.04.4 LTS installation. FYI, this version of gnuplot was released on 1.03.2011.

As far as I could see from the gnuplot documentation, this "new" syntax is pr Juesent since version 4.4. There were no backward compatibility references whatsoever.

P.S. Just found out that this breaks the other functionality where you provide the relative legend position by keywords like "left", in my case: CastaliaResults -i 140325-135747.txt -s got | CastaliaPlot -o valueProp-1seed.png -s histogram --invert -l left

Update: Replacing line 388 with this:

if options.legend: key += "at " + options.legend if options.legend[0].isdigit() else options.legend

will solve the broken keywords. The backward compatibility issue remains though.

RatijitMitra commented 8 years ago

I replaced the line 388 with your provided one. But now it is showing the error -

line 0: undefined variable: left

when i run the command -

CastaliaResults -i 160225-210253.txt -s got | CastaliaPlot -o valueProp-1seed.png -s histogram --invert -l left

What should be done next? I guess there is something after the second if condition of line 388 that you may have missed.

boulis commented 8 years ago

Which version of Gnuplot are you using? Versions released after 4.4 are probable to have compatibility problems with the CastaliaPlot script as v4r15 discovered.

Does the command work when you do not include the "-l left" option? Run CastaliaPlot with the -d option to see all commands issued to gnuplot.

RatijitMitra commented 8 years ago

I am using Version 4.6 patchlevel 4. Yup it works fine without "-l left" switch.

boulis commented 8 years ago

I see two options:

  1. You could run it with -d and see the offending command, and then try to figure out what is the proper command in the new version you have, and change the code of CastaliaPlot accordingly.

Or (perhaps simpler solution)

  1. You could install an older version of gnuplot in a different directory (you do not have to uninstall your default newer version) and point CastaliaPlot to the old version using the --gnuplot switch (full path of the gniplot executable you wan to use)