Skip to content

Commit a081d01

Browse files
authored
fix the RTD timeouts (#4254)
* try adding a :okwarning: option * ignore more warnings * ignore even more warnings
1 parent 1be777f commit a081d01

File tree

1 file changed

+44
-1
lines changed

1 file changed

+44
-1
lines changed

doc/plotting.rst

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ One Dimension
9999
The simplest way to make a plot is to call the :py:func:`DataArray.plot()` method.
100100

101101
.. ipython:: python
102+
:okwarning:
102103
103104
air1d = air.isel(lat=10, lon=10)
104105
@@ -125,6 +126,7 @@ can be used:
125126
.. _matplotlib.pyplot.plot: http://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.plot
126127

127128
.. ipython:: python
129+
:okwarning:
128130
129131
@savefig plotting_1d_additional_args.png width=4in
130132
air1d[:200].plot.line("b-^")
@@ -137,6 +139,7 @@ can be used:
137139
Keyword arguments work the same way, and are more explicit.
138140

139141
.. ipython:: python
142+
:okwarning:
140143
141144
@savefig plotting_example_sin3.png width=4in
142145
air1d[:200].plot.line(color="purple", marker="o")
@@ -151,6 +154,7 @@ In this example ``axes`` is an array consisting of the left and right
151154
axes created by ``plt.subplots``.
152155

153156
.. ipython:: python
157+
:okwarning:
154158
155159
fig, axes = plt.subplots(ncols=2)
156160
@@ -178,6 +182,7 @@ support the ``aspect`` and ``size`` arguments which control the size of the
178182
resulting image via the formula ``figsize = (aspect * size, size)``:
179183

180184
.. ipython:: python
185+
:okwarning:
181186
182187
air1d.plot(aspect=2, size=3)
183188
@savefig plotting_example_size_and_aspect.png
@@ -219,6 +224,7 @@ without coordinates along the x-axis. To illustrate this, let's calculate a 'dec
219224
from the time and assign it as a non-dimension coordinate:
220225

221226
.. ipython:: python
227+
:okwarning:
222228
223229
decimal_day = (air1d.time - air1d.time[0]) / pd.Timedelta("1d")
224230
air1d_multi = air1d.assign_coords(decimal_day=("time", decimal_day))
@@ -227,20 +233,23 @@ from the time and assign it as a non-dimension coordinate:
227233
To use ``'decimal_day'`` as x coordinate it must be explicitly specified:
228234

229235
.. ipython:: python
236+
:okwarning:
230237
231238
air1d_multi.plot(x="decimal_day")
232239
233240
Creating a new MultiIndex named ``'date'`` from ``'time'`` and ``'decimal_day'``,
234241
it is also possible to use a MultiIndex level as x-axis:
235242

236243
.. ipython:: python
244+
:okwarning:
237245
238246
air1d_multi = air1d_multi.set_index(date=("time", "decimal_day"))
239247
air1d_multi.plot(x="decimal_day")
240248
241249
Finally, if a dataset does not have any coordinates it enumerates all data points:
242250

243251
.. ipython:: python
252+
:okwarning:
244253
245254
air1d_multi = air1d_multi.drop("date")
246255
air1d_multi.plot()
@@ -256,6 +265,7 @@ with appropriate arguments. Consider the 3D variable ``air`` defined above. We c
256265
plots to check the variation of air temperature at three different latitudes along a longitude line:
257266

258267
.. ipython:: python
268+
:okwarning:
259269
260270
@savefig plotting_example_multiple_lines_x_kwarg.png
261271
air.isel(lon=10, lat=[19, 21, 22]).plot.line(x="time")
@@ -277,6 +287,7 @@ If required, the automatic legend can be turned off using ``add_legend=False``.
277287
It is also possible to make line plots such that the data are on the x-axis and a dimension is on the y-axis. This can be done by specifying the appropriate ``y`` keyword argument.
278288

279289
.. ipython:: python
290+
:okwarning:
280291
281292
@savefig plotting_example_xy_kwarg.png
282293
air.isel(time=10, lon=[10, 11]).plot(y="lat", hue="lon")
@@ -299,6 +310,7 @@ The argument ``where`` defines where the steps should be placed, options are
299310
when plotting data grouped with :py:meth:`Dataset.groupby_bins`.
300311

301312
.. ipython:: python
313+
:okwarning:
302314
303315
air_grp = air.mean(["time", "lon"]).groupby_bins("lat", [0, 23.5, 66.5, 90])
304316
air_mean = air_grp.mean()
@@ -321,6 +333,7 @@ Other axes kwargs
321333
The keyword arguments ``xincrease`` and ``yincrease`` let you control the axes direction.
322334

323335
.. ipython:: python
336+
:okwarning:
324337
325338
@savefig plotting_example_xincrease_yincrease_kwarg.png
326339
air.isel(time=10, lon=[10, 11]).plot.line(
@@ -340,6 +353,7 @@ Two Dimensions
340353
The default method :py:meth:`DataArray.plot` calls :py:func:`xarray.plot.pcolormesh` by default when the data is two-dimensional.
341354

342355
.. ipython:: python
356+
:okwarning:
343357
344358
air2d = air.isel(time=500)
345359
@@ -350,6 +364,7 @@ All 2d plots in xarray allow the use of the keyword arguments ``yincrease``
350364
and ``xincrease``.
351365

352366
.. ipython:: python
367+
:okwarning:
353368
354369
@savefig 2d_simple_yincrease.png width=4in
355370
air2d.plot(yincrease=False)
@@ -369,6 +384,7 @@ and ``xincrease``.
369384
xarray plots data with :ref:`missing_values`.
370385

371386
.. ipython:: python
387+
:okwarning:
372388
373389
bad_air2d = air2d.copy()
374390
@@ -386,6 +402,7 @@ It's not necessary for the coordinates to be evenly spaced. Both
386402
produce plots with nonuniform coordinates.
387403

388404
.. ipython:: python
405+
:okwarning:
389406
390407
b = air2d.copy()
391408
# Apply a nonlinear transformation to one of the coords
@@ -402,6 +419,7 @@ Since this is a thin wrapper around matplotlib, all the functionality of
402419
matplotlib is available.
403420

404421
.. ipython:: python
422+
:okwarning:
405423
406424
air2d.plot(cmap=plt.cm.Blues)
407425
plt.title("These colors prove North America\nhas fallen in the ocean")
@@ -421,6 +439,7 @@ matplotlib is available.
421439
``d_ylog.plot()`` updates the xlabel.
422440

423441
.. ipython:: python
442+
:okwarning:
424443
425444
plt.xlabel("Never gonna see this.")
426445
air2d.plot()
@@ -436,6 +455,7 @@ xarray borrows logic from Seaborn to infer what kind of color map to use. For
436455
example, consider the original data in Kelvins rather than Celsius:
437456

438457
.. ipython:: python
458+
:okwarning:
439459
440460
@savefig plotting_kelvin.png width=4in
441461
airtemps.air.isel(time=0).plot()
@@ -454,6 +474,7 @@ Here we add two bad data points. This affects the color scale,
454474
washing out the plot.
455475

456476
.. ipython:: python
477+
:okwarning:
457478
458479
air_outliers = airtemps.air.isel(time=0).copy()
459480
air_outliers[0, 0] = 100
@@ -469,6 +490,7 @@ This will use the 2nd and 98th
469490
percentiles of the data to compute the color limits.
470491

471492
.. ipython:: python
493+
:okwarning:
472494
473495
@savefig plotting_robust2.png width=4in
474496
air_outliers.plot(robust=True)
@@ -487,6 +509,7 @@ rather than the default continuous colormaps that matplotlib uses. The
487509
colormaps. For example, to make a plot with 8 discrete color intervals:
488510

489511
.. ipython:: python
512+
:okwarning:
490513
491514
@savefig plotting_discrete_levels.png width=4in
492515
air2d.plot(levels=8)
@@ -495,13 +518,15 @@ It is also possible to use a list of levels to specify the boundaries of the
495518
discrete colormap:
496519

497520
.. ipython:: python
521+
:okwarning:
498522
499523
@savefig plotting_listed_levels.png width=4in
500524
air2d.plot(levels=[0, 12, 18, 30])
501525
502526
You can also specify a list of discrete colors through the ``colors`` argument:
503527

504528
.. ipython:: python
529+
:okwarning:
505530
506531
flatui = ["#9b59b6", "#3498db", "#95a5a6", "#e74c3c", "#34495e", "#2ecc71"]
507532
@savefig plotting_custom_colors_levels.png width=4in
@@ -559,13 +584,15 @@ arguments to the xarray plotting methods/functions. This returns a
559584
:py:class:`xarray.plot.FacetGrid` object.
560585

561586
.. ipython:: python
587+
:okwarning:
562588
563589
@savefig plot_facet_dataarray.png
564590
g_simple = t.plot(x="lon", y="lat", col="time", col_wrap=3)
565591
566592
Faceting also works for line plots.
567593

568594
.. ipython:: python
595+
:okwarning:
569596
570597
@savefig plot_facet_dataarray_line.png
571598
g_simple_line = t.isel(lat=slice(0, None, 4)).plot(
@@ -582,6 +609,7 @@ a fixed amount. Now we can see how the temperature maps would compare if
582609
one were much hotter.
583610

584611
.. ipython:: python
612+
:okwarning:
585613
586614
t2 = t.isel(time=slice(0, 2))
587615
t4d = xr.concat([t2, t2 + 40], pd.Index(["normal", "hot"], name="fourth_dim"))
@@ -603,6 +631,7 @@ Faceted plotting supports other arguments common to xarray 2d plots.
603631
plt.close("all")
604632
605633
.. ipython:: python
634+
:okwarning:
606635
607636
hasoutliers = t.isel(time=slice(0, 5)).copy()
608637
hasoutliers[0, 0, 0] = -100
@@ -649,6 +678,7 @@ Here is an example of using the lower level API and then modifying the axes afte
649678
they have been plotted.
650679

651680
.. ipython:: python
681+
:okwarning:
652682
653683
g = t.plot.imshow("lon", "lat", col="time", col_wrap=3, robust=True)
654684
@@ -688,13 +718,15 @@ Consider this dataset
688718
Suppose we want to scatter ``A`` against ``B``
689719

690720
.. ipython:: python
721+
:okwarning:
691722
692723
@savefig ds_simple_scatter.png
693724
ds.plot.scatter(x="A", y="B")
694725
695726
The ``hue`` kwarg lets you vary the color by variable value
696727

697728
.. ipython:: python
729+
:okwarning:
698730
699731
@savefig ds_hue_scatter.png
700732
ds.plot.scatter(x="A", y="B", hue="w")
@@ -705,6 +737,7 @@ You can force a legend instead of a colorbar by setting ``hue_style='discrete'``
705737
Additionally, the boolean kwarg ``add_guide`` can be used to prevent the display of a legend or colorbar (as appropriate).
706738

707739
.. ipython:: python
740+
:okwarning:
708741
709742
ds = ds.assign(w=[1, 2, 3, 5])
710743
@savefig ds_discrete_legend_hue_scatter.png
@@ -713,13 +746,15 @@ Additionally, the boolean kwarg ``add_guide`` can be used to prevent the display
713746
The ``markersize`` kwarg lets you vary the point's size by variable value. You can additionally pass ``size_norm`` to control how the variable's values are mapped to point sizes.
714747

715748
.. ipython:: python
749+
:okwarning:
716750
717751
@savefig ds_hue_size_scatter.png
718752
ds.plot.scatter(x="A", y="B", hue="z", hue_style="discrete", markersize="z")
719753
720754
Faceting is also possible
721755

722756
.. ipython:: python
757+
:okwarning:
723758
724759
@savefig ds_facet_scatter.png
725760
ds.plot.scatter(x="A", y="B", col="x", row="z", hue="w", hue_style="discrete")
@@ -738,14 +773,16 @@ To follow this section you'll need to have Cartopy installed and working.
738773
This script will plot the air temperature on a map.
739774

740775
.. ipython:: python
776+
:okwarning:
741777
742778
import cartopy.crs as ccrs
743779
744780
air = xr.tutorial.open_dataset("air_temperature").air
745781
746782
p = air.isel(time=0).plot(
747783
subplot_kws=dict(projection=ccrs.Orthographic(-80, 35), facecolor="gray"),
748-
transform=ccrs.PlateCarree())
784+
transform=ccrs.PlateCarree(),
785+
)
749786
p.axes.set_global()
750787
751788
@savefig plotting_maps_cartopy.png width=100%
@@ -788,6 +825,7 @@ There are three ways to use the xarray plotting functionality:
788825
These are provided for user convenience; they all call the same code.
789826

790827
.. ipython:: python
828+
:okwarning:
791829
792830
import xarray.plot as xplt
793831
@@ -837,6 +875,7 @@ think carefully about what the limits, labels, and orientation for
837875
each of the axes should be.
838876

839877
.. ipython:: python
878+
:okwarning:
840879
841880
@savefig plotting_example_2d_simple.png width=4in
842881
a.plot()
@@ -857,6 +896,7 @@ xarray, but you'll have to tell the plot function to use these coordinates
857896
instead of the default ones:
858897

859898
.. ipython:: python
899+
:okwarning:
860900
861901
lon, lat = np.meshgrid(np.linspace(-20, 20, 5), np.linspace(0, 30, 4))
862902
lon += lat / 10
@@ -876,6 +916,7 @@ on a polar projection (:issue:`781`). This is why the default is to not follow
876916
this convention when plotting on a map:
877917

878918
.. ipython:: python
919+
:okwarning:
879920
880921
import cartopy.crs as ccrs
881922
@@ -890,6 +931,7 @@ You can however decide to infer the cell boundaries and use the
890931
``infer_intervals`` keyword:
891932

892933
.. ipython:: python
934+
:okwarning:
893935
894936
ax = plt.subplot(projection=ccrs.PlateCarree())
895937
da.plot.pcolormesh("lon", "lat", ax=ax, infer_intervals=True)
@@ -908,6 +950,7 @@ You can however decide to infer the cell boundaries and use the
908950
One can also make line plots with multidimensional coordinates. In this case, ``hue`` must be a dimension name, not a coordinate name.
909951

910952
.. ipython:: python
953+
:okwarning:
911954
912955
f, ax = plt.subplots(2, 1)
913956
da.plot.line(x="lon", hue="y", ax=ax[0])

0 commit comments

Comments
 (0)