ruby-numo / numo-gnuplot

Gnuplot wrapper for Ruby/Numo
BSD 3-Clause "New" or "Revised" License
51 stars 8 forks source link

Error in set format command #9

Closed yusami closed 7 years ago

yusami commented 7 years ago

Tanaka-san,

I have a question regarding the usage of set command. What is the proper way to use "set format"? I got the error in the code below with the debug mode enabled.

Numo.gnuplot do
 ...
 set format: {x: "%Y-%m-%d"}
 ...
end
>gnuplot> set 
>             ^
>         line 0: unrecognized option - see 'help set'.

It seems to be OK with the code below.

 ...
 set datafile: {separator: "','"}
 set xtics: "rotate by -45"
 ...

I found the keyword "format_x" in the library. It is, however, not the valid command for gnuplot so I got another error like this.

>gnuplot> set format_x "%Y-%m-%d"
>             ^
>         line 0: unrecognized option - see 'help set'.

I'd appreciate it if you have any advice.

Thanks.

masa16 commented 7 years ago

Secure way is

  set 'format x "%Y-%m-%d"'

Recent commit (https://github.com/ruby-numo/gnuplot/commit/9b8f0d796c0e17bbda47e321024dd93b3f90bff0) allows two patterns you suggested:

  set format_x: "%Y-%m-%d"
  set format: {x: "%Y-%m-%d"}
yusami commented 7 years ago

Thank you for the quick fix. It works fine for me.