You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Once I worked around #14, I discovered many problems. One of them was that my plot options were not being used in the correct order.
Since options are specified with a Ruby Hash, the simplest way that I can think of to specify an order of the options would be to simply use the native order of the input Hash. Ever since Ruby 1.9, iteration order of Hashes is insertion order.
As I dug deeper, I noticed that option order is specifically being changed by GnuplotRB::Dataset::OPTION_ORDER. It's great that I found out that I can change this constant to fix my issues, but the underlying problem remains. If I'm using options that GnuplotRB doesn't specifically know about and special-case, there's no way for me to plot without mucking in the library.
At first, I thought this change would be as simple as switching the #sort_by call to a stable sort. But it seems like the root cause runs deeper. GnuplotRB is converting the Hash options to a Hamster::Hash. Unlike Ruby's built-in Hash, Hamster::Hash doesn't preserve order.
Unfortunately, Hamster doesn't provide an OrderedHash. My first question is, what's the reason for using Hamster::Hash in favor of the built-in Hash?
The text was updated successfully, but these errors were encountered:
Once I worked around #14, I discovered many problems. One of them was that my plot options were not being used in the correct order.
Since options are specified with a Ruby Hash, the simplest way that I can think of to specify an order of the options would be to simply use the native order of the input Hash. Ever since Ruby 1.9, iteration order of Hashes is insertion order.
As I dug deeper, I noticed that option order is specifically being changed by
GnuplotRB::Dataset::OPTION_ORDER
. It's great that I found out that I can change this constant to fix my issues, but the underlying problem remains. If I'm using options that GnuplotRB doesn't specifically know about and special-case, there's no way for me to plot without mucking in the library.At first, I thought this change would be as simple as switching the
#sort_by
call to a stable sort. But it seems like the root cause runs deeper. GnuplotRB is converting the Hash options to aHamster::Hash
. Unlike Ruby's built-in Hash,Hamster::Hash
doesn't preserve order.Unfortunately, Hamster doesn't provide an OrderedHash. My first question is, what's the reason for using Hamster::Hash in favor of the built-in Hash?
The text was updated successfully, but these errors were encountered: