Menu

#828 displaying key sample in "with pm3d" style with explicit fillcolor

Version 6
pending-accepted
nobody
None
5
1 day ago
2025-06-14
No

Displaying a key sample is generally unnecessary for the "with pm3d" style, since it typically uses palette-based coloring. However, when a fillcolor is explicitly specified, showing a key sample becomes meaningful. This is particularly useful in combination with the "zclip" option.

I have attached a patch file along with some sample scripts.

This patch implements conditional key sample display: a key sample is shown only when an explicit fillcolor is specified in a with pm3d plot. While this can also be achieved using keyentry, I think this approach provides a more direct and simpler way to annotate surfaces.

7 Attachments

Discussion

  • Ethan Merritt

    Ethan Merritt - 2025-06-15

    Looks good. I have applied this for 6.1.

    There's a related issue (low priority) you might want to think about.
    When the surface is 2-sided with a separate color for the top and bottom, it might be nice to show both colors in the key sample. help pm3d fillcolor. This has been a minor issue for hidden3d surfaces all along, but now that you've added a key sample for pm3d it's also an issue for pm3d surfaces. At some view angles the entire visible surface might be a mismatch with the key sample.

    I have not looked at it, but perhaps it would be possible to split the key sample rectangle into a top half and a bottom half that match the colors of the 2-sided surface?

    Test case attached

     
    • Hiroki Motoyoshi

      Thank you very much for applying it so promptly.

      Since "fillcolor rgb variable" does not require a key sample, I modified the condition used to determine whether to draw the key sample accordingly.

      Next, I added code to draw two-colored key samples for the special case of "fillcolor ls N".
      In this case, the top and bottom colors are represented on the upper and lower halves of a rectangle divided along the diagonal.
      This diagonal representation is simply a matter of personal preference, so if you would prefer a vertical split instead, it can be easily modified.

       
      • Ethan Merritt

        Ethan Merritt - 2025-06-16

        Excellent.

         
  • Ethan Merritt

    Ethan Merritt - 2025-06-16
    • status: open --> pending-accepted
     

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.