@@ -158,36 +158,42 @@ def Main(self):
158158 ina = self .I_Na (V , m , h )
159159 ik = self .I_K (V , n )
160160 il = self .I_L (V )
161-
162- plt .figure (figsize = [15 ,10 ])
161+
162+ #increase figure and font size for display in jupyter notebook
163+ if __name__ != '__main__' :
164+ plt .rcParams ['figure.figsize' ] = [12 , 8 ]
165+ plt .rcParams ['font.size' ] = 15
166+ plt .rcParams ['legend.fontsize' ] = 12
167+
168+ fig = plt .figure ()
163169
164170 ax1 = plt .subplot (4 ,1 ,1 )
165171 plt .xlim ([np .min (self .t ),np .max (self .t )]) #for all subplots
166- plt .title ('Hodgkin-Huxley Neuron' , fontsize = 20 )
167- plt . plot ( self .t , V , 'k' )
168- plt .ylabel ( 'V (mV)' , fontsize = 15 )
169-
172+ plt .title ('Hodgkin-Huxley Neuron' )
173+ i_inj_values = [ self .I_inj ( t ) for t in self . t ]
174+ plt .plot ( self . t , i_inj_values , 'k' )
175+ plt . ylabel ( '$I_{inj}$ ($ \\ mu{A}/cm^2$)' )
170176
171177 plt .subplot (4 ,1 ,2 , sharex = ax1 )
172178 plt .plot (self .t , ina , 'c' , label = '$I_{Na}$' )
173179 plt .plot (self .t , ik , 'y' , label = '$I_{K}$' )
174180 plt .plot (self .t , il , 'm' , label = '$I_{L}$' )
175- plt .ylabel ('Current' , fontsize = 15 )
176- plt .legend (bbox_to_anchor = ( 1.1 , 0.5 ), loc = 'center right' , fontsize = 15 , borderaxespad = 0 )
181+ plt .ylabel ('Current' )
182+ plt .legend ()
177183
178184 plt .subplot (4 ,1 ,3 , sharex = ax1 )
179185 plt .plot (self .t , m , 'r' , label = 'm' )
180186 plt .plot (self .t , h , 'g' , label = 'h' )
181187 plt .plot (self .t , n , 'b' , label = 'n' )
182- plt .ylabel ('Gating Value' , fontsize = 15 )
183- plt .legend (bbox_to_anchor = ( 1.1 , 0.5 ), loc = 'center right' , fontsize = 15 , borderaxespad = 0 )
188+ plt .ylabel ('Gating Value' )
189+ plt .legend ()
184190
185191 plt .subplot (4 ,1 ,4 , sharex = ax1 )
186- i_inj_values = [ self . I_inj ( t ) for t in self . t ]
187- plt .plot (self .t , i_inj_values , 'k' )
188- plt .xlabel ( 't (ms)' , fontsize = 15 )
189- plt .ylabel ( '$I_{inj}$ ($ \\ mu{A}/cm^2$)' , fontsize = 15 )
190- plt .ylim (- 1 , 40 )
192+
193+ plt .plot (self .t , V , 'k' )
194+ plt .ylabel ( 'V (mV)' )
195+ plt .xlabel ( 't (ms)' )
196+ # plt.ylim(-1, 40)
191197
192198 plt .tight_layout ()
193199 plt .show ()
0 commit comments