Skip to content

multi word keys in options #7

Open

Description

@ievgrafov

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

Activity

  1. mess110 commented on Jun 18, 2015

    @mess110

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

  2. ievgrafov commented on Jun 18, 2015

    @ievgrafov
    OwnerAuthor

    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?

  3. mess110 commented on Jun 18, 2015

    @mess110

    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

  4. ievgrafov commented on Jun 18, 2015

    @ievgrafov
    OwnerAuthor

    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.

  5. agisga commented on Jun 18, 2015

    @agisga
    Contributor

    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?

  6. ievgrafov commented on Jun 19, 2015

    @ievgrafov
    OwnerAuthor

    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...
    
  7. added this to the milestone on Jun 20, 2015
  8. added a commit that references this issue on Jun 22, 2015
  9. changed the title [-]set style[/-] [+]multi word keys in options[/+] on Jun 22, 2015
  10. modified the milestone: on Jun 22, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions