Operating system: windows
Slicer version: 4.11.0
Expected behavior: Hide legends by LegendVisibilityOff()
Actual behavior: can’t turn legends off via cripts
Probably you have several chart nodes and in the code snippet you only modify the first one, which may not be the one you are interested in. You can get the displayed chart node from the plot widget, and the widget from the layout manager.
@lassoan
Thanks a lot. Basically I understand what you mentioned.
But after I did set up the visibility to be false by
plotChartNode_ID.SetLegendVisibility(False) and then I checked if it was false as printed out as follows ==> LegendVisibility: false. So that means, in the python scripts there, somehow, sometime the legend was set to be “false” not-shown there. But later somehow something brought it back to be “true” shown there.
While the legend was still shown there until I did manual commands from the “python interactor” to do again, since, checking from “python interactor”, I saw the “legendVisibility: True” there before I did manual commands.
printed inside scripts after I did set it to be “False”.
in “python interactor”, before I manually changed to be “False”.
So please help check if there is kind of glitch there for the legend-visibility. Thanks a lot.
@Alex_Vergara
I did try applying your way. I have to say it’s kind of the same case I described. That means, while I clicked the checkbox on or off to show or hide legends, it worked just perfectly fine. But that’s not what I need. Since I would have hundreds times of screen-shot of the plots, one time/one plot for one sample, I need try to hide legends in the plot while I capture the plot. I am pretty sure of that there is some glitch inside something/somewhere.
I will try something else to see if I may skip this issue.
I think there were some extra touching parameters of legends there to get it from False to True.
So right after set it as False, it’s just good there to hide legends!