|
77 | 77 | # setting and the :ref:`user guide <ug_1dstd>`). |
78 | 78 |
|
79 | 79 | # %% |
80 | | -import ultraplot as uplt |
81 | 80 | import numpy as np |
82 | 81 |
|
| 82 | +import ultraplot as uplt |
| 83 | + |
83 | 84 | # Sample data |
84 | 85 | state = np.random.RandomState(51423) |
85 | 86 | x = y = np.array([-10, -5, 0, 5, 10]) |
|
110 | 111 | axs[3].contourf(xedges, yedges, data) |
111 | 112 |
|
112 | 113 | # %% |
113 | | -import ultraplot as uplt |
114 | 114 | import numpy as np |
115 | 115 |
|
| 116 | +import ultraplot as uplt |
| 117 | + |
116 | 118 | # Sample data |
117 | 119 | cmap = "turku_r" |
118 | 120 | state = np.random.RandomState(51423) |
|
184 | 186 | # `~pint.UnitRegistry.setup_matplotlib` so that the axes become unit-aware. |
185 | 187 |
|
186 | 188 | # %% |
187 | | -import xarray as xr |
188 | 189 | import numpy as np |
189 | 190 | import pandas as pd |
| 191 | +import xarray as xr |
190 | 192 |
|
191 | 193 | # DataArray |
192 | 194 | state = np.random.RandomState(51423) |
|
261 | 263 | # ``diverging=True``, ``cyclic=True``, or ``qualitative=True`` to any plotting |
262 | 264 | # command. If the colormap type is not explicitly specified, `sequential` is |
263 | 265 | # used with the default linear normalizer when data is strictly positive |
264 | | -# or negative, and `diverging` is used with the :ref:`diverging normalizer <ug_norm>` |
| 266 | +# or negative, and `diverging` is used with the :ref:`diverging normalizer <ug_apply_norm>` |
265 | 267 | # when the data limits or colormap levels cross zero (see :ref:`below <ug_autonorm>`). |
266 | 268 |
|
267 | 269 | # %% |
268 | | -import ultraplot as uplt |
269 | 270 | import numpy as np |
270 | 271 |
|
| 272 | +import ultraplot as uplt |
| 273 | + |
271 | 274 | # Sample data |
272 | 275 | N = 18 |
273 | 276 | state = np.random.RandomState(51423) |
|
294 | 297 | uplt.rc.reset() |
295 | 298 |
|
296 | 299 | # %% |
297 | | -import ultraplot as uplt |
298 | 300 | import numpy as np |
299 | 301 |
|
| 302 | +import ultraplot as uplt |
| 303 | + |
300 | 304 | # Sample data |
301 | 305 | N = 20 |
302 | 306 | state = np.random.RandomState(51423) |
|
322 | 326 | colorbar="b", |
323 | 327 | ) |
324 | 328 |
|
325 | | -import ultraplot as uplt |
326 | 329 | import numpy as np |
327 | 330 |
|
| 331 | +import ultraplot as uplt |
| 332 | + |
328 | 333 | # Sample data |
329 | 334 | N = 20 |
330 | 335 | state = np.random.RandomState(51423) |
|
347 | 352 | # Special normalizers |
348 | 353 | # ------------------- |
349 | 354 | # |
350 | | -# UltraPlot includes two new :ref:`"continuous" normalizers <ug_norm>`. The |
| 355 | +# UltraPlot includes two new :ref:`"continuous" normalizers <ug_apply_norm>`. The |
351 | 356 | # `~ultraplot.colors.SegmentedNorm` normalizer provides even color gradations with respect |
352 | 357 | # to index for an arbitrary monotonically increasing or decreasing list of levels. This |
353 | 358 | # is automatically applied if you pass unevenly spaced `levels` to a plotting command, |
|
372 | 377 | # affect the interpretation of different datasets. |
373 | 378 |
|
374 | 379 | # %% |
375 | | -import ultraplot as uplt |
376 | 380 | import numpy as np |
377 | 381 |
|
| 382 | +import ultraplot as uplt |
| 383 | + |
378 | 384 | # Sample data |
379 | 385 | state = np.random.RandomState(51423) |
380 | 386 | data = 11 ** (2 * state.rand(20, 20).cumsum(axis=0) / 7) |
|
395 | 401 | ) |
396 | 402 | ax.format(title=norm.title() + " normalizer") |
397 | 403 | # %% |
398 | | -import ultraplot as uplt |
399 | 404 | import numpy as np |
400 | 405 |
|
| 406 | +import ultraplot as uplt |
| 407 | + |
401 | 408 | # Sample data |
402 | 409 | state = np.random.RandomState(51423) |
403 | 410 | data1 = (state.rand(20, 20) - 0.485).cumsum(axis=1).cumsum(axis=0) |
|
434 | 441 | # commands (e.g., :func:`~ultraplot.axes.PlotAxes.contourf`, :func:`~ultraplot.axes.PlotAxes.pcolor`). |
435 | 442 | # This is analogous to `matplotlib.colors.BoundaryNorm`, except |
436 | 443 | # `~ultraplot.colors.DiscreteNorm` can be paired with arbitrary |
437 | | -# continuous normalizers specified by `norm` (see :ref:`above <ug_norm>`). |
| 444 | +# continuous normalizers specified by `norm` (see :ref:`above <ug_apply_norm>`). |
438 | 445 | # Discrete color levels can help readers discern exact numeric values and |
439 | 446 | # tend to reveal qualitative structure in the data. `~ultraplot.colors.DiscreteNorm` |
440 | 447 | # also repairs the colormap end-colors by ensuring the following conditions are met: |
|
463 | 470 | # the zero level (useful for single-color :func:`~ultraplot.axes.PlotAxes.contour` plots). |
464 | 471 |
|
465 | 472 | # %% |
466 | | -import ultraplot as uplt |
467 | 473 | import numpy as np |
468 | 474 |
|
| 475 | +import ultraplot as uplt |
| 476 | + |
469 | 477 | # Sample data |
470 | 478 | state = np.random.RandomState(51423) |
471 | 479 | data = 10 + state.normal(0, 1, size=(33, 33)).cumsum(axis=0).cumsum(axis=1) |
|
485 | 493 | axs[2].format(title="Imshow plot\ndiscrete=False (default)", yformatter="auto") |
486 | 494 |
|
487 | 495 | # %% |
488 | | -import ultraplot as uplt |
489 | 496 | import numpy as np |
490 | 497 |
|
| 498 | +import ultraplot as uplt |
| 499 | + |
491 | 500 | # Sample data |
492 | 501 | state = np.random.RandomState(51423) |
493 | 502 | data = (20 * (state.rand(20, 20) - 0.4).cumsum(axis=0).cumsum(axis=1)) % 360 |
|
547 | 556 | # the 2D :class:`~ultraplot.axes.PlotAxes` commands will apply the diverging colormap |
548 | 557 | # :rc:`cmap.diverging` (rather than :rc:`cmap.sequential`) and the diverging |
549 | 558 | # normalizer `~ultraplot.colors.DivergingNorm` (rather than :class:`~matplotlib.colors.Normalize` |
550 | | -# -- see :ref:`above <ug_norm>`) if the following conditions are met: |
| 559 | +# -- see :ref:`above <ug_apply_norm>`) if the following conditions are met: |
551 | 560 | # |
552 | 561 | # #. If discrete levels are enabled (see :ref:`above <ug_discrete>`) and the |
553 | 562 | # level list includes at least 2 negative and 2 positive values. |
|
560 | 569 | # setting :rcraw:`cmap.autodiverging` to ``False``. |
561 | 570 |
|
562 | 571 | # %% |
563 | | -import ultraplot as uplt |
564 | 572 | import numpy as np |
565 | 573 |
|
| 574 | +import ultraplot as uplt |
| 575 | + |
566 | 576 | N = 20 |
567 | 577 | state = np.random.RandomState(51423) |
568 | 578 | data = N * 2 + (state.rand(N, N) - 0.45).cumsum(axis=0).cumsum(axis=1) * 10 |
|
605 | 615 | # command documentation for details. |
606 | 616 |
|
607 | 617 | # %% |
608 | | -import ultraplot as uplt |
609 | | -import pandas as pd |
610 | 618 | import numpy as np |
| 619 | +import pandas as pd |
| 620 | + |
| 621 | +import ultraplot as uplt |
611 | 622 |
|
612 | 623 | # Sample data |
613 | 624 | state = np.random.RandomState(51423) |
|
663 | 674 | # `~ultraplot.axes.CartesianAxes`. |
664 | 675 |
|
665 | 676 | # %% |
666 | | -import ultraplot as uplt |
667 | 677 | import numpy as np |
668 | 678 | import pandas as pd |
669 | 679 |
|
| 680 | +import ultraplot as uplt |
| 681 | + |
670 | 682 | # Covariance data |
671 | 683 | state = np.random.RandomState(51423) |
672 | 684 | data = state.normal(size=(10, 10)).cumsum(axis=0) |
|
0 commit comments