hoffstadt / hoffstadt/DearPyGui

Provide programmatic access to plot legends' unique ability to show/hide series

Open
#1,481 5 comments 2 reactions 0 assignees View on GitHub
category: plots priority: medium type: feature
Dominant language
C++
Stars
15.6k
Forks
783
PR merge metrics
No merged PRs in 30d

Description

**Is your feature request related to a problem? Please describe.**
There is inconsistent behavior between toggling a series of a plot on/off by clicking its color in the legend and using the hide_item()/show_item() functions. Clicking the legend causes the plot to stop displaying the series and greys out its label in the legend. It can be shown by clicking its label again. Hiding the series by calling hide_item(series) removes it from the plot AND the legend. It can only be returned by calling "show_item(series)".

Additionally, there is no programmatic way to check if a series is being hidden by the legend (its "show" parameter will still equal True) or to cause this effect without clicking.

**Describe the solution you'd like**
I would prefer that the legend behavior be the default behavior of show_item() and hide_item() as applied to a series. This would make it possible to check and control programmatically without introducing new functions or properties of series.

**Describe alternatives you've considered**
For consistency, the current behavior of show_item() and hide_item() applied to a series can remain in order to remove them from the plot and legend without destroying them. A new property or new function would be added to give programmatic checking and control of the special behavior seen when hiding a series using the legend.

**Additional context**
The following images illustrate the normal state of a two-series bar plot, its state when one series is hidden using the legend, and its state when one series is hidden by calling hide_item() using the series ID:
![plot-show](https://user-images.githubusercontent.com/7157089/145959706-d6c7f574-9288-4ee1-985d-af733e13e5c4.PNG)
![plot-legend-hide](https://user-images.githubusercontent.com/7157089/145959727-9fb50042-b9e6-43e9-a903-68659a5733e0.PNG)
![plot-function-hide](https://user-images.githubusercontent.com/7157089/145959735-450e2614-3439-4636-8f48-9a058f7a8084.PNG)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.