sage icon indicating copy to clipboard operation
sage copied to clipboard

`bar_chart` ignores the `zorder` option (bars always drawn under gridlines)

Open fernandodemorais-jf opened this issue 2 months ago • 1 comments

Steps To Reproduce

  1. Run the following minimal example in SageMath:
P = bar_chart([1, 2, 3],
              rgbcolor='blue',
              zorder=10,        # Should place bars on top
              gridlines=True,
              gridlinesstyle={'color': 'gray', 'lw': 1, 'zorder': 0}) # Grid behind

P.show()
  1. Observe the resulting plot;
  2. Notice that the gridlines appear above the bars, despite zorder=10.

Expected Behavior

  • Bars should be drawn above the gridlines when the user provides a larger zorder, such as zorder=10.
  • The zorder option should control drawing order, consistent with Matplotlib and other Sage graphics primitives.

Actual Behavior

  • The zorder option is ignored;
  • Users cannot control the drawing order of bars using the zorder parameter.

Additional Information

Suggested fix

Modify the _render_on_subplot method to forward the zorder option:

subplot.bar(
    ind,
    datalist,
    color=color,
    width=width,
    label=options['legend_label'],
    zorder=options.get('zorder', None)   # <<< FIX
)

Environment

  • OS: Arch Linux x86_64
  • Sage Version: 10.5

Checklist

  • [x] I have searched the existing issues for a bug report that matches the one I want to file, without success.
  • [x] I have read the documentation and troubleshoot guide

fernandodemorais-jf avatar Nov 20 '25 06:11 fernandodemorais-jf

can i work on this issue ?

amxnn05 avatar Nov 21 '25 09:11 amxnn05

can i work on this issue ?

Hello, @amxnn05! I don’t have permission to assign it, but if the message was directed to me, feel free to work on the issue.

Thanks!

fernandodemorais-jf avatar Nov 27 '25 13:11 fernandodemorais-jf