Menu

#455 plot style "with errorradius" [was: circle drawing bug]

None
open
nobody
None
1
2023-09-30
2016-08-12
Anonymous
No

When you plot a circle (using "with circles") then the circle is only plotted if the center of the circle is inside the canvas. If the circle is inside the canvas but its center is outside, then the circle will not be plotted.
I cannot imagine this is desirable behaviour and for my application it is very annoying or even makes the circle drawing functionality unusable.

Discussion

  • Ethan Merritt

    Ethan Merritt - 2016-08-12
    • status: open --> open-not-a-bug
    • Group: -->
    • Priority: -->
     
  • Ethan Merritt

    Ethan Merritt - 2016-08-12

    The same is true for all plot styles.
    From "help clip":

    Data points whose center lies outside the plot boundaries are never drawn.
    
     
    • Marvin Raaijmakers

      Okay maybe this is not a bug in the sense that the implementation does not meet its specification, but more in the sense that the specification is not well-thought of, at least in the circle drawing case.

      I can only imagine that such a clipping rule could be considered usefull if circles are used to represent a data point, where the "position" of the data point is used as a center and some other quantity of the data point is visualized by the radius. In such case I could accept the current clipping rule based on an argument like: "the plot should only visualize data points of which the location (which is visualized by the circle's center) is inside the plot's canvas, since that is the region of interest the user chose to evaluate the data".
      Furthermore if I understand it correctly, for such use cases the user could chose to draw points (with the circular point style) and a variable point size.

      However in the case where the user wants to use circles to visualize data that actually represents geometric circles (by that I mean that the radius of the plotted circle really represents the radius of a circle instead of some other quantity), then the current clipping rule makes no sense to me. This is because in this case the circle represents a geometric object, which can be inside my region of interest even if its center is outside.
      For me in such case clipping should be used as a kind of preprocessing step to filter out those geometric objects that are not going to be visible anyway.
      Unfortunaly for this use case gnuplot cannot be used.

      Let me explain my specific use case.
      I want to analyze an algorithm that detects circles in a set of points. I want to plot all the points that served as the input of the algorithm and all detected circles in the output. In order to analyze how the points vary around the detected circle I am only interested in a small region around the border of the circle. Gnuplot currently does not allow me to do this (without yet another gnuplot hack/trick/workaround) since my region of interest does not include the circle's center.

       
      • Ethan Merritt

        Ethan Merritt - 2016-08-13

        Your conceptual plot makes sense but it doesn't match gnuplot's existing logic. You are essentially thinking of the circle as an error radius about a point, whereas gnuplot is thinking of the circle as the primary object. Consider:

        1) A plot "with points" will omit out-of-range points no matter how large you set the pointsize

        2) Plotting "with boxes" will omit any box whose defining center point is out-of-range, no matter what the associated boxwidth

        3) However, "with xerrorbars" will include a portion of the horizontal error bar from that same out-of-range center point, and

        4) "with xyerrorbars" will include a portion of an out-of-bounds rectangle.

        What you describe amounts to a hypothetical plot style "with errorradius" that would draw some portion of the circular error bar for an out-of-bounds center. I have no problem with that idea but we do not have such a plot style right now.

         
  • Hans-Bernhard Broeker

    If the circle is inside the canvas but its center is outside,

    That's geometrically impossible, anyway.

     
    • Marvin Raaijmakers

      Sure it is possible. Canvas has x range from 0 to 10 and y range from 0 10. The circle has center (11, 0) and radius 5. Then the center is outside the canvas and the circle is inside (i.e. the circle intersects the canvas).

       

      Last edit: Marvin Raaijmakers 2016-08-13
      • Hans-Bernhard Broeker

        the circle intersects the canvas).

        And that's quite a different thing from it being in the canvas. Precision matters, also in speaking about such things.

         
  • Ethan Merritt

    Ethan Merritt - 2016-08-27

    Ticket moved from /p/gnuplot/bugs/1839/

    Can't be converted:

    • _milestone:
    • _priority:
     
  • Ethan Merritt

    Ethan Merritt - 2016-08-27
    • summary: circle drawing bug --> plot style "with errorradius" [was: circle drawing bug]
    • status: open-not-a-bug --> open
    • Priority: --> 1
     
  • Anthony

    Anthony - 2020-02-20

    The same is true for circle objects... Posted feature request #499
    https://sourceforge.net/p/gnuplot/feature-requests/499/

     
  • Hiroki Motoyoshi

    Although the plot command is a bit verbose, this feature can be emulated by the 'sectors' style introduced in gnuplot version 6.

    The sector style is designed to draw annular segments. But if the sector angle is greater than 360 deg, it is designed to draw perfect annulars. And then, by setting the inner radius of annular to 0, a perfect circle can be drawn. Please check help document of the 'sectors' style for details.

    Here is a sample script executable with gnuplot 6.0rc1.

    #
    # Drawing a circle whose center is outside the graph area
    #
    #   Emulation with the 'sectors' style introduced after gnuplot version 6.
    #
    
    set terminal pngcairo
    
    $data <<EOD
    5 10 3
    11 5 2
    11 5 3
    11 5 4
    11 5 5
    11 -1 2
    11 -1 3
    11 -1 4
    11 -1 5
    -5 10 10
    EOD
    
    set xrange [0:10]
    set yrange [0:20]
    set isotropic
    
    set angle degrees
    
    set output "with_sectors.png"
    plot $data using (0):(0):(361):3:1:2 with sectors notitle, \
         keyentry with circles lt 1 title "emulated by sectors"
    
    set output "with_circles.png"
    plot $data using 1:2:3 with circles title "circles"
    

    with_sectors.png

     

    Last edit: Hiroki Motoyoshi 2023-09-30

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.