Menu

#1460 Dashtype for grid, arrows and object

closed-fixed
nobody
None
5
2015-03-23
2014-08-09
mccusti
No

I am playing with the dashtype functionnality in Gnuplot 5.0_rc1 and I noticed some dysfunctions.
For grids, these two scripts display identical results
reset
set grid
plot x

reset
set grid dt 2
plot x

However, when a linetype is given, the dashtype is taken into account
reset
set grid lt 1 dt 2
plot x

For arrows, the problem is the same: the dashtype is applied only if a linetype is given.

Finally for rectangles, the dashtype is always ignored
reset
set object rect from 0,0 to 2,3 lt 1 dt 2
plot x

This script creates a rectangle with solid lines.

I made these tests on Windows 7 and the wxt terminal.

Related

Bugs: #1460

Discussion

  • Ethan Merritt

    Ethan Merritt - 2014-08-13

    Grid:

    By default the grid is drawn with linetype 0 (a.k.a. LT_AXIS) which is reserved for this purpose. It is a special linetype that has a built-in dot pattern and cannot be assigned a separate dash pattern. If you change the grid to use some other linetype then you can change the dash pattern as you like.

    So this was intentional, but if people don't like it then we could reconsider.

    Rectangles:

    This seems to be a bug in something to do with interpreting the "set obj rectangle" command, or perhaps with applying it on top of the default settings. For example, here rect 2 is correctly drawn but rect 1 is not:

      set obj 1 rect from 0,0 to 2,3 lt 1 dt 2
      set obj 2 rect from -2,-3 to 0,0 lt 1 dt 2 fc bgnd fs empty bo -1
    

    Arrows:

    I think this is the same as with rectangles. It is a parsing bug rather than a rendering bug. Should be fixable.

     
    • Ethan Merritt

      Ethan Merritt - 2014-08-16

      The use of dash types in rectangles should now be fixed in CVS.

      Arrows turn out to be a separate problem - basically the arrow code
      was never modified to use the new dash types. To the extent it works
      right now it's just happenstance.

      On Wed, Aug 13, 2014 at 11:01 AM, Ethan Merritt sfeam@users.sf.net wrote:

      Grid:

      By default the grid is drawn with linetype 0 (a.k.a. LT_AXIS) which is reserved for this purpose. It is a special linetype that has a built-in dot pattern and cannot be assigned a separate dash pattern. If you change the grid to use some other linetype then you can change the dash pattern as you like.

      So this was intentional, but if people don't like it then we could reconsider.

      Rectangles:

      This seems to be a bug in something to do with interpreting the "set obj rectangle" command, or perhaps with applying it on top of the default settings. For example, here rect 2 is correctly drawn but rect 1 is not:

        set obj 1 rect from 0,0 to 2,3 lt 1 dt 2
        set obj 2 rect from -2,-3 to 0,0 lt 1 dt 2 fc bgnd fs empty bo -1
      

      Arrows:

      I think this is the same as with rectangles. It is a parsing bug rather than a rendering bug. Should be fixable.


      ** [bugs:#1460] Dashtype for grid, arrows and object**

      Status: open
      Group: 5.0
      Created: Sat Aug 09, 2014 03:21 PM UTC by mccusti
      Last Updated: Sat Aug 09, 2014 03:21 PM UTC
      Owner: nobody

      I am playing with the dashtype functionnality in Gnuplot 5.0_rc1 and I noticed some dysfunctions.
      For grids, these two scripts display identical results
      reset
      set grid
      plot x

      reset
      set grid dt 2
      plot x

      However, when a linetype is given, the dashtype is taken into account
      reset
      set grid lt 1 dt 2
      plot x

      For arrows, the problem is the same: the dashtype is applied only if a linetype is given.

      Finally for rectangles, the dashtype is always ignored
      reset
      set object rect from 0,0 to 2,3 lt 1 dt 2
      plot x

      This script creates a rectangle with solid lines.

      I made these tests on Windows 7 and the wxt terminal.


      Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/gnuplot/bugs/1460/

      To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/

       

      Related

      Bugs: #1460

  • Ethan Merritt

    Ethan Merritt - 2014-08-15

    The use of dash types in rectangles should now be fixed in CVS.

    Arrows turn out to be a separate problem - basically the arrow code
    was never modified to use the new dash types. To the extent it works
    right now it's just happenstance.

     
  • Ethan Merritt

    Ethan Merritt - 2014-08-18
    • status: open --> pending-fixed
     
  • Ethan Merritt

    Ethan Merritt - 2014-08-18

    Fixed now, I hope. The fix includes new code to insure that arrow heads are always drawn with a solid line even if the arrow shaft has a dash pattern.

     
  • Ethan Merritt

    Ethan Merritt - 2014-08-20
    • status: pending-fixed --> closed-fixed
     
  • Christoph Bersch

    Hi Ethan,

    yes the dash types now apply also to rectangles. Unfortunately the line color is now ignored:

    set linetype 1 lc rgb '#880088' lw 5 dt 2
    set object rect from -5,-5 to 0,0 lt 1
    set object rect from 0,0 to 5,5 lt 2 lw 5
    plot x, 2*x lw 5
    

    Thank you,
    Christoph

     
  • Ethan Merritt

    Ethan Merritt - 2014-08-20

    But the command you show has never been legal:

    gnuplot_4.6.5:
    gnuplot> set object rect from -5,-5 to 0,0 lt 1
                                               ^
             Unrecognized or duplicate option
    

    In current 5.0.rc1 the command that does what you probably want is

       set object 1 rect from -5, -5 to 0,0 fs empty border 1 dt 2 lw 5
    

    That is, the dashtype and linewidth are properties of the rectangle itself, but the line colour is a property of the border. Version 4.6 was the same except of course that there was no dashtype property.

    At one point I tried to attach all the properties to the border, but the code got horribly complex and I gave up on the idea. Conversely, one could make the linetype a property of the rectangle and do away with the border linetype, but that would break all previous scripts using rectangles.

    Suggestions?

     
  • Christoph Bersch

    Yes, I got confused a bit regarding the syntax.

    I think, if the dashtype is easier to implement as rectangle property instead of border property its fine for me. I was just a bit confused, since I didn't get an error using the wrong order.

    BTW: Is the dashtype supposed to work also with circles? A command like

    set object circle at 0,0 radius 3 dt 2
    plot x
    

    draws no circle at all.

     
  • Ethan Merritt

    Ethan Merritt - 2014-08-22

    Well, it actually does draw the circle. But the only color associated with that object is "background" so it draws in the background color and you can't see it.

    The more general problem is that the current parsing routines get totally confused between "fillcolor" and "linecolor".

     

Log in to post a comment.

MongoDB Logo MongoDB