@@ -592,7 +592,9 @@ def __init__(self, canvas, parent, coordinates=True):
592
592
def _icon (self , name ):
593
593
if is_pyqt5 ():
594
594
name = name .replace ('.png' , '_large.png' )
595
- return QtGui .QIcon (os .path .join (self .basedir , name ))
595
+ pm = QtGui .QPixmap (os .path .join (self .basedir , name ))
596
+ pm .setDevicePixelRatio (self .canvas ._dpi_ratio )
597
+ return QtGui .QIcon (pm )
596
598
597
599
def _init_toolbar (self ):
598
600
self .basedir = os .path .join (matplotlib .rcParams ['datapath' ], 'images' )
@@ -602,7 +604,7 @@ def _init_toolbar(self):
602
604
self .addSeparator ()
603
605
else :
604
606
a = self .addAction (self ._icon (image_file + '.png' ),
605
- text , getattr (self , callback ))
607
+ text , getattr (self , callback ))
606
608
self ._actions [callback ] = a
607
609
if callback in ['zoom' , 'pan' ]:
608
610
a .setCheckable (True )
@@ -624,29 +626,13 @@ def _init_toolbar(self):
624
626
QtCore .Qt .AlignRight | QtCore .Qt .AlignTop )
625
627
self .locLabel .setSizePolicy (
626
628
QtWidgets .QSizePolicy (QtWidgets .QSizePolicy .Expanding ,
627
- QtWidgets .QSizePolicy .Ignored ))
629
+ QtWidgets .QSizePolicy .Ignored ))
628
630
labelAction = self .addWidget (self .locLabel )
629
631
labelAction .setVisible (True )
630
632
631
633
# reference holder for subplots_adjust window
632
634
self .adj_window = None
633
635
634
- # Esthetic adjustments - we need to set these explicitly in PyQt5
635
- # otherwise the layout looks different - but we don't want to set it if
636
- # not using HiDPI icons otherwise they look worse than before.
637
- if is_pyqt5 ():
638
- self .setIconSize (QtCore .QSize (24 , 24 ))
639
- self .layout ().setSpacing (12 )
640
-
641
- if is_pyqt5 ():
642
- # For some reason, self.setMinimumHeight doesn't seem to carry over to
643
- # the actual sizeHint, so override it instead in order to make the
644
- # aesthetic adjustments noted above.
645
- def sizeHint (self ):
646
- size = super (NavigationToolbar2QT , self ).sizeHint ()
647
- size .setHeight (max (48 , size .height ()))
648
- return size
649
-
650
636
def edit_parameters (self ):
651
637
allaxes = self .canvas .figure .get_axes ()
652
638
if not allaxes :
0 commit comments