File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed
Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -744,12 +744,24 @@ def _update_plot(self, _=None):
744744 else :
745745 self .pdos_data = self ._get_pdos_data ()
746746 self .bands_data = self ._get_bands_data ()
747+
748+ # Get current axis range
749+ xaxis_range = list (self .bandsplot_widget .layout ["xaxis" ]["range" ])
750+ yaxis_range = list (self .bandsplot_widget .layout ["yaxis" ]["range" ])
751+
747752 self .bandsplot_widget = BandPdosPlotly (
748753 bands_data = self .bands_data ,
749754 pdos_data = self .pdos_data ,
750755 project_bands = self .project_bands_box .value ,
751756 ).bandspdosfigure
752757 self ._clear_output_and_display (self .bandsplot_widget )
758+
759+ # Restore Old axis range. I do it after the plot is displayed to the Reset button always return to the Default SETTINGs
760+ if self .bands_data :
761+ self .bandsplot_widget .plotly_relayout ({"yaxis.range" : yaxis_range })
762+ if self .pdos_data and not self .bands_data :
763+ self .bandsplot_widget .plotly_relayout ({"xaxis.range" : xaxis_range })
764+
753765 self .proj_bands_width_slider .layout .visibility = (
754766 "visible" if self .project_bands_box .value else "hidden"
755767 )
You can’t perform that action at this time.
0 commit comments