@@ -201,13 +201,12 @@ def _table(obj, data): # noqa: C901
201201
202202 if isinstance (xdata_alt [0 ], datetime .datetime ):
203203 xdata = xdata_alt
204- elif isinstance (xdata_alt [0 ], str ):
205- data ["current axes" ].axis_options += [
206- "xtick={{{}}}" .format ("," .join ([f"{ x :{ff }} " for x in xdata ])),
207- "xticklabels={{{}}}" .format ("," .join (xdata_alt )),
208- ]
209- xdata , ydata = transform_to_data_coordinates (obj , xdata , ydata )
210204 else :
205+ if isinstance (xdata_alt [0 ], str ):
206+ data ["current axes" ].axis_options += [
207+ "xtick={{{}}}" .format ("," .join ([f"{ x :{ff }} " for x in xdata ])),
208+ "xticklabels={{{}}}" .format ("," .join (xdata_alt )),
209+ ]
211210 xdata , ydata = transform_to_data_coordinates (obj , xdata , ydata )
212211
213212 # matplotlib allows plotting of data containing `astropy.units`, but they will break
@@ -252,12 +251,9 @@ def _table(obj, data): # noqa: C901
252251 if not option .startswith ("xmin" )
253252 ]
254253 xmin , xmax = data ["current mpl axes obj" ].get_xlim ()
255- data ["current axes" ].axis_options .append (
256- "xmin={}, xmax={}" .format (
257- num2date (xmin ).strftime ("%Y-%m-%d %H:%M" ),
258- num2date (xmax ).strftime ("%Y-%m-%d %H:%M" ),
259- )
260- )
254+ mindate = num2date (xmin ).strftime ("%Y-%m-%d %H:%M" )
255+ maxdate = num2date (xmax ).strftime ("%Y-%m-%d %H:%M" )
256+ data ["current axes" ].axis_options .append (f"xmin={ mindate } , xmax={ maxdate } " )
261257 else :
262258 opts = []
263259 xformat = ff
@@ -267,7 +263,7 @@ def _table(obj, data): # noqa: C901
267263 # don't want the \n in the table definition, just in the data (below)
268264 opts .append ("row sep=" + data ["table_row_sep" ].strip ())
269265
270- if data ["externals search path" ] is not None :
266+ if data ["externalize tables" ] and data [ " externals search path" ] is not None :
271267 esp = data ["externals search path" ]
272268 opts .append (f"search path={{{ esp } }}" )
273269
@@ -280,9 +276,10 @@ def _table(obj, data): # noqa: C901
280276 plot_table = []
281277 table_row_sep = data ["table_row_sep" ]
282278 ydata [ydata_mask ] = np .nan
283- if any (ydata_mask ) or (~ np .isfinite (ydata )).any ():
284- # matplotlib jumps at masked or nan values, while PGFPlots by default interpolates.
285- # Hence, if we have a masked plot, make sure that PGFPlots jumps as well.
279+ if np .any (ydata_mask ) or ~ np .all (np .isfinite (ydata )):
280+ # matplotlib jumps at masked or nan values, while PGFPlots by default
281+ # interpolates. Hence, if we have a masked plot, make sure that PGFPlots jumps
282+ # as well.
286283 if "unbounded coords=jump" not in data ["current axes" ].axis_options :
287284 data ["current axes" ].axis_options .append ("unbounded coords=jump" )
288285
0 commit comments