Skip to content

[Feature] add zorder #1049

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

[Feature] add zorder #1049

wants to merge 1 commit into from

Conversation

Tau-J
Copy link
Contributor

@Tau-J Tau-J commented Apr 4, 2023

Thanks for your contribution and we appreciate it a lot. The following instructions would make your pull request more healthy and more easily get feedback. If you do not understand some items, don't worry, just make the pull request and seek help from maintainers.

Motivation

According to Z-Order of matplotlib, lines will be in the front of circles by defaults, which results in a wrong visualization result in MMPose as follows:

image

I suggest adding zorder in draw_xxx() functions to support customized orders.

Please describe the motivation of this PR and the goal you want to achieve through this PR.

Modification

Please briefly describe what modification is made in this PR.

BC-breaking (Optional)

Does the modification introduce changes that break the backward-compatibility of the downstream repos?
If so, please describe how it breaks the compatibility and how the downstream projects should modify their code to keep compatibility with this PR.

Use cases (Optional)

If this PR introduces a new feature, it is better to list some use cases here, and update the documentation.

Checklist

  1. Pre-commit or other linting tools are used to fix the potential lint issues.
  2. The modification is covered by complete unit tests. If not, please add more unit test to ensure the correctness.
  3. If the modification has potential influence on downstream projects, this PR should be tested with downstream projects, like MMDet or MMCls.
  4. The documentation has been modified accordingly, like docstring or example tutorials.

@CLAassistant
Copy link

CLAassistant commented Apr 4, 2023

CLA assistant check
All committers have signed the CLA.

@@ -410,7 +417,7 @@ def draw_texts(
font_families: Union[str, List[str]] = 'sans-serif',
bboxes: Optional[Union[dict, List[dict]]] = None,
font_properties: Optional[Union['FontProperties',
List['FontProperties']]] = None
List['FontProperties']]] = None,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: Union['FontProperties', List['FontProperties'], None] = None,

@@ -615,6 +625,7 @@ def draw_circles(
line_widths: Union[Union[int, float], List[Union[int, float]]] = 2,
face_colors: Union[str, tuple, List[str], List[tuple]] = 'none',
alpha: Union[float, int] = 0.8,
zorder: float = 1.0,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the reason for using zorder=1.0 for draw_circles but zorder=2.0 for draw_boxes

@@ -384,6 +385,7 @@ def draw_points(self,
marker styles. Defaults to None.
sizes (Optional[Union[np.ndarray, torch.Tensor]]): The marker size.
Defaults to None.
zorder (float): The z-order of points. Defaults to 1.0.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Refer to the description here(https://matplotlib.org/stable/gallery/misc/zorder_demo.html) and refine the docstring

@HAOCHENYE HAOCHENYE added this to the 0.7.3 milestone Apr 23, 2023
Copy link

codecov bot commented Sep 26, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Please upload report for BASE (main@fd84c21). Learn more about missing BASE report.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1049   +/-   ##
=======================================
  Coverage        ?   76.25%           
=======================================
  Files           ?      139           
  Lines           ?    11074           
  Branches        ?     2218           
=======================================
  Hits            ?     8444           
  Misses          ?     2272           
  Partials        ?      358           
Flag Coverage Δ
unittests 76.25% <100.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants