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
dilcom opened this Issue Jun 18, 2015 · 6 comments

Comments

Projects
None yet
3 participants
@dilcom
Owner

dilcom commented Jun 18, 2015

'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 ...

@dilcom dilcom added the bug label Jun 18, 2015

@mess110

This comment has been minimized.

mess110 commented Jun 18, 2015

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

@dilcom

This comment has been minimized.

Owner

dilcom commented Jun 18, 2015

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

This comment has been minimized.

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

@dilcom

This comment has been minimized.

Owner

dilcom commented Jun 18, 2015

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

This comment has been minimized.

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?

@dilcom

This comment has been minimized.

Owner

dilcom commented Jun 19, 2015

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...

@dilcom dilcom added this to the 0.1.2 milestone Jun 20, 2015

dilcom added a commit that referenced this issue Jun 22, 2015

@dilcom dilcom changed the title from set style to multi word keys in options Jun 22, 2015

@dilcom dilcom removed the bug label Jun 22, 2015

@dilcom dilcom 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