-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
[Bug]: 3D bar chart appears over axis when using zlim #29482
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Also happens with 3.10. |
The axes "panels", tick marks, and tick labels do not participate in the
same zorder sorting that the bars do. They are all drawn before any other
artist. Given that mplot3d cannot properly compose complex scenes with
intersecting bounding cubes, I doubt this problem will get addressed. The
workaround is to set the view limits to fully encompass the data you are
viewing.
…On Sat, Jan 18, 2025 at 6:33 PM Tim Hoffmann ***@***.***> wrote:
Also happens with 3.10.
—
Reply to this email directly, view it on GitHub
<#29482 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AACHF6CYCIJCUQQNSOWNXMT2LLQFHAVCNFSM6AAAAABVOAEGPSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMMBQGI4DIMJRGY>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Thank you @XrioBtw for the great expected outcome images, those really help clarify the question! This is somewhat a duplicate of #8902 However, I do think there is a good argument for drawing the axes with the same zorder sorting as the rest of the elements, like the bottom right plot. So let's keep this issue open with a focus on that aspect of the question. |
3d clipping would likely mitigate a lot of the visual artifacts by clipping
away anything that would extend beyond the panels.
I will repeat that you absolutely do not want the panels participating in
the zorder sorting. Consider the case of a bar in the back corner of the
graph. The distance of all of the panels (as measured from the midpoint)
will be closer to the camera than the bar, and the bar would get drawn
under the panels. The panels were specifically intended to always be behind
anything being drawn, so they get drawn first and no compute effort is
spent trying to figure out where it belongs in the zorder.
…On Wed, Jan 22, 2025 at 7:25 PM Scott Shambaugh ***@***.***> wrote:
This is somewhat a duplicate of #8902
<#8902>
However, I do think there is a good argument for drawing the axes with the
same zorder sorting as the rest of the elements, like the bottom right
plot. So let's keep this issue open with a focus on that aspect of the
question.
—
Reply to this email directly, view it on GitHub
<#29482 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AACHF6BJXKTBK7GHL4ZSY432MAZIJAVCNFSM6AAAAABVOAEGPSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMMBYGU3DKMZSGM>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Yeah I agree the panes should always be in the back. I do think it's worth experimenting with the axis spines, ticks, and labels either always being on top or getting z order sorted. The bottom right plot seems clearly better than the top one, but I'm sure there's some lurking edge cases. |
This is a separate but somewhat related issue. I tried to set the z-axis limit using Is there a way to set the z limits exactly as those intended? |
Hi @sgwu, I would upgrade! That behavior was finally fixed in matplotlib 3.9.0, see: https://matplotlib.org/stable/users/prev_whats_new/whats_new_3.9.0.html#setting-3d-axis-limits-now-set-the-limits-exactly |
Thanks @scottshambaugh, this solves my problem! |
Bug summary
When I make a 3D bar chart with Matplotlib and change the z axis limits using
ax.set_zlim(newMin, newMax)
the part of the bar charts below the new z axis minimum value appears above the x and y axis. I would like to ensure that the x and y axis always renders at the top, but I don't know how to achieve this. I triedax.set_zorder(bigNumber)
andax.xaxis.set_zorder(bigNumber)
, but it didn't change anything.Code for reproduction
Actual outcome
The actual outcome looks like this, where the bar charts render over the x and y axis:
Expected outcome
Either left or right would be expected outcome:
Additional information
No response
Operating system
Windows
Matplotlib Version
3.6.0
Matplotlib Backend
TkAgg
Python version
3.10.6
Jupyter version
No response
Installation
pip
The text was updated successfully, but these errors were encountered: