@@ -201,13 +201,12 @@ def _table(obj, data): # noqa: C901
201
201
202
202
if isinstance (xdata_alt [0 ], datetime .datetime ):
203
203
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 )
210
204
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
+ ]
211
210
xdata , ydata = transform_to_data_coordinates (obj , xdata , ydata )
212
211
213
212
# matplotlib allows plotting of data containing `astropy.units`, but they will break
@@ -252,12 +251,9 @@ def _table(obj, data): # noqa: C901
252
251
if not option .startswith ("xmin" )
253
252
]
254
253
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 } " )
261
257
else :
262
258
opts = []
263
259
xformat = ff
@@ -267,7 +263,7 @@ def _table(obj, data): # noqa: C901
267
263
# don't want the \n in the table definition, just in the data (below)
268
264
opts .append ("row sep=" + data ["table_row_sep" ].strip ())
269
265
270
- if data ["externals search path" ] is not None :
266
+ if data ["externalize tables" ] and data [ " externals search path" ] is not None :
271
267
esp = data ["externals search path" ]
272
268
opts .append (f"search path={{{ esp } }}" )
273
269
@@ -280,9 +276,10 @@ def _table(obj, data): # noqa: C901
280
276
plot_table = []
281
277
table_row_sep = data ["table_row_sep" ]
282
278
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.
286
283
if "unbounded coords=jump" not in data ["current axes" ].axis_options :
287
284
data ["current axes" ].axis_options .append ("unbounded coords=jump" )
288
285
0 commit comments