88from matplotlib .figure import Figure
99from matplotlib .lines import Line2D
1010from matplotlib .patches import Circle
11- from matplotlib .ticker import AutoLocator , FuncFormatter
11+ from matplotlib .ticker import AutoLocator , AutoMinorLocator , FuncFormatter
1212
1313import matplotlib .pyplot as plt
1414import matplotlib .transforms as tx
@@ -1004,6 +1004,7 @@ def show_polar(self):
10041004 worker .signals .error .connect (self .async_worker_error )
10051005
10061006 def finish_show_polar (self , iviewer ):
1007+
10071008 if self .mode != ViewType .polar :
10081009 # Image mode was switched during generation. Ignore this.
10091010 return
@@ -1034,10 +1035,36 @@ def finish_show_polar(self, iviewer):
10341035 }
10351036 self .axes_images .append (self .axis .imshow (** kwargs ))
10361037 self .axis .axis ('auto' )
1038+
1039+ self .axis .yaxis .set_major_locator (AutoLocator ())
1040+ self .axis .yaxis .set_minor_locator (AutoMinorLocator ())
1041+
1042+ self .axis .xaxis .set_major_locator (AutoLocator ())
1043+ self .axis .xaxis .set_minor_locator (AutoMinorLocator ())
1044+
1045+ kwargs = {
1046+ 'left' : True ,
1047+ 'right' : True ,
1048+ 'bottom' : True ,
1049+ 'top' : True ,
1050+ 'which' : 'major' ,
1051+ 'length' : 10 ,
1052+ 'labelfontfamily' : 'serif' ,
1053+ 'labelsize' : 14
1054+ }
1055+ self .axis .tick_params (** kwargs )
1056+
1057+ kwargs ['which' ] = 'minor'
1058+ kwargs ['length' ] = 2
1059+ self .axis .tick_params (** kwargs )
1060+
1061+ self .axis .tick_params (bottom = True , top = True , which = 'major' , length = 8 )
1062+ self .axis .tick_params (bottom = True , top = True , which = 'minor' , length = 2 )
1063+
10371064 # Do not allow the axis to autoscale, which could happen if
10381065 # overlays are drawn out-of-bounds
10391066 self .axis .autoscale (False )
1040- self .axis .set_ylabel (r'$\eta $ [deg]' )
1067+ self .axis .set_ylabel (r'$\phi $ [deg]' , fontsize = 14 , family = 'serif ' )
10411068 self .axis .label_outer ()
10421069 else :
10431070 rescale_image = False
@@ -1053,11 +1080,11 @@ def finish_show_polar(self, iviewer):
10531080 axis = self .figure .add_subplot (grid [3 , 0 ], sharex = self .axis )
10541081 data = (tth , self .compute_azimuthal_integral_sum ())
10551082 unscaled = (tth , self .compute_azimuthal_integral_sum (False ))
1056- self .azimuthal_line_artist , = axis .plot (* data )
1083+ self .azimuthal_line_artist , = axis .plot (* data , '-k' , lw = 2.5 )
10571084 HexrdConfig ().last_unscaled_azimuthal_integral_data = unscaled
10581085
10591086 self .azimuthal_integral_axis = axis
1060- axis .set_ylabel (r'Azimuthal Average' )
1087+ axis .set_ylabel (r'Azimuthal Average' , fontsize = 14 , family = 'serif' )
10611088 self .update_azimuthal_plot_overlays ()
10621089 self .update_wppf_plot ()
10631090
@@ -1067,15 +1094,37 @@ def finish_show_polar(self, iviewer):
10671094 formatter = PolarXAxisFormatter (default_formatter , f )
10681095 axis .xaxis .set_major_formatter (formatter )
10691096
1097+ axis .yaxis .set_major_locator (AutoLocator ())
1098+ axis .yaxis .set_minor_locator (AutoMinorLocator ())
1099+
1100+ axis .xaxis .set_major_locator (AutoLocator ())
1101+ axis .xaxis .set_minor_locator (AutoMinorLocator ())
1102+
1103+ kwargs = {
1104+ 'left' : True ,
1105+ 'right' : True ,
1106+ 'bottom' : True ,
1107+ 'top' : True ,
1108+ 'which' : 'major' ,
1109+ 'length' : 10 ,
1110+ 'labelfontfamily' : 'serif' ,
1111+ 'labelsize' : 14
1112+ }
1113+ axis .tick_params (** kwargs )
1114+
1115+ kwargs ['which' ] = 'minor'
1116+ kwargs ['length' ] = 2
1117+ axis .tick_params (** kwargs )
1118+
10701119 # Set our custom tick locators as well
1071- self .axis .xaxis .set_major_locator (PolarXAxisTickLocator (self ))
1072- axis .xaxis .set_major_locator (PolarXAxisTickLocator (self ))
1120+ # self.axis.xaxis.set_major_locator(PolarXAxisTickLocator(self))
1121+ # axis.xaxis.set_major_locator(PolarXAxisTickLocator(self))
10731122 else :
10741123 self .update_azimuthal_integral_plot ()
10751124 axis = self .azimuthal_integral_axis
10761125
10771126 # Update the xlabel in case it was modified (via tth distortion)
1078- axis .set_xlabel (self .polar_xlabel )
1127+ axis .set_xlabel (self .polar_xlabel , fontsize = 14 , family = 'serif' )
10791128 else :
10801129 if len (self .axes_images ) == 0 :
10811130 self .axis = self .figure .add_subplot (111 )
@@ -1087,13 +1136,13 @@ def finish_show_polar(self, iviewer):
10871136 'interpolation' : 'none' ,
10881137 }
10891138 self .axes_images .append (self .axis .imshow (** kwargs ))
1090- self .axis .set_ylabel (r'$\eta $ [deg]' )
1139+ self .axis .set_ylabel (r'$\phi $ [deg]' , fontsize = 14 , family = 'serif ' )
10911140 else :
10921141 rescale_image = False
10931142 self .axes_images [0 ].set_data (img )
10941143
10951144 # Update the xlabel in case it was modified (via tth distortion)
1096- self .axis .set_xlabel (self .polar_xlabel )
1145+ self .axis .set_xlabel (self .polar_xlabel , fontsize = 14 , family = 'serif' )
10971146
10981147 if rescale_image :
10991148 self .axis .relim ()
@@ -1193,7 +1242,8 @@ def polar_x_axis_type(self):
11931242
11941243 def on_polar_x_axis_type_changed (self ):
11951244 # Update the x-label
1196- self .azimuthal_integral_axis .set_xlabel (self .polar_xlabel )
1245+ self .azimuthal_integral_axis .set_xlabel (self .polar_xlabel ,
1246+ fontsize = 14 , family = 'serif' )
11971247
11981248 # Still need to draw if the x-label was modified
11991249 self .draw_idle ()
0 commit comments