Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

multi word keys in options #7

Open
ievgrafov opened this issue Jun 18, 2015 · 6 comments
Open

multi word keys in options #7

ievgrafov opened this issue Jun 18, 2015 · 6 comments

Comments

@ievgrafov
Copy link
Owner

'set style' command may be used several times to set different options. Currently it's not handled by gem

example:
set style data histograms
set style fill ...

@ievgrafov ievgrafov added the bug label Jun 18, 2015
@mess110
Copy link

mess110 commented Jun 18, 2015

Do you have a list of such commands? Or is this the only case?

@ievgrafov
Copy link
Owner Author

Currently I faced with only 'set style' option.
Usually I consider options as set [key] [value] and here I think key is 'style data' or 'style function' or 'style fill' (they are considered different in gnuplot docs too) Thus I'm going to allow option keys like :style_function and :style_fill and replace '_' with space before unputting it to gnuplot.
This will allow to use plot.options(style_data: 'histograms', style_fill: '...') in this case for example.
What do you think?

@mess110
Copy link

mess110 commented Jun 18, 2015

Are there any commands in gnuplot which are separated similarly? Maybe there is an option called awesome_option which would also be separated and we might not want that.

An alternative could be plot.options(style: { data: 'histograms', fill: '...' })

I think we should get some more opinions on the topic @agisga @agarie

@ievgrafov
Copy link
Owner Author

The point is that this command can't be used this way.
plot.options(style: { data: 'histograms', fill: '...' })
will produce
set style data histograms fill ...
but gnuplot waits for

set style data histograms
set style fill ...

So this will require to make exception for style in hash-as-option treatment.

I also looked through gnuplot docs and found that there are some other separated options ('set object |index|' for example) and found no underline separated options. Of course they may appear later.

@agisga
Copy link
Contributor

agisga commented Jun 18, 2015

I am not very familiar with gnuplot yet, so I might be wrong, but I think that most of the time the user will not use style multiple times (like style data ... and style fill ... simultaneously). Therefore, I think that the syntax with the underscore is less cumbersome and more straight forward:
style_data: 'histograms' vs style: {data: 'histograms'}

You should also keep in mind that, based on how other options work, the user might expect that she can write:
style: 'data histograms'
to produce
set style data histograms
for gnuplot, if she does not need to specify multiple style options simultaneously.
Do you want to allow or forbid that behaviour?

@ievgrafov
Copy link
Owner Author

Yes, it's really possible case and all following options are the same (if we decide to implement underscore):

plot.style('data histograms')
plot.style_data('histograms')
plot.style(data: 'histograms')
plot.style_data_histograms(true)
plot.options(style: 'data histograms')
etc...

@ievgrafov ievgrafov added this to the 0.1.2 milestone Jun 20, 2015
@ievgrafov ievgrafov changed the title set style multi word keys in options Jun 22, 2015
@ievgrafov ievgrafov removed the bug label Jun 22, 2015
@ievgrafov ievgrafov modified the milestone: 0.1.2 Jun 22, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants