|
14 | 14 | (multiple) images with matplotlib. In matplotlib, the axes location |
15 | 15 | (and size) is specified in the normalized figure coordinates, which |
16 | 16 | may not be ideal for displaying images that needs to have a given |
17 | | -aspect ratio. For example, it helps you to have a colorbar whose |
| 17 | +aspect ratio. For example, it helps if you have a colorbar whose |
18 | 18 | height always matches that of the image. `ImageGrid`_, `RGB Axes`_ and |
19 | 19 | `AxesDivider`_ are helper classes that deals with adjusting the |
20 | 20 | location of (multiple) Axes. They provides a framework to adjust the |
|
276 | 276 | Example 2. twin |
277 | 277 | ~~~~~~~~~~~~~~~ |
278 | 278 |
|
279 | | -*twin* without a transform argument treat the parasite axes to have a |
| 279 | +*twin* without a transform argument assumes that the parasite axes has the |
280 | 280 | same data transform as the host. This can be useful when you want the |
281 | 281 | top(or right)-axis to have different tick-locations, tick-labels, or |
282 | 282 | tick-formatter for bottom(or left)-axis. :: |
|
407 | 407 | AxesDivider |
408 | 408 | =========== |
409 | 409 |
|
410 | | -The axes_divider module provide helper classes to adjust the axes |
411 | | -positions of set of images in the drawing time. |
| 410 | +The axes_divider module provides helper classes to adjust the axes |
| 411 | +positions of a set of images at drawing time. |
412 | 412 |
|
413 | | -* :mod:`~mpl_toolkits.axes_grid1.axes_size` provides a classes of |
414 | | - units that the size of each axes will be determined. For example, |
415 | | - you can specify a fixed size |
| 413 | +* :mod:`~mpl_toolkits.axes_grid1.axes_size` provides a class of |
| 414 | + units that are used to determine the size of each axes. For example, |
| 415 | + you can specify a fixed size. |
416 | 416 |
|
417 | | -* :class:`~mpl_toolkits.axes_grid1.axes_size.Divider` this is the class |
418 | | - that is used calculates the axes position. It divides the given |
419 | | - rectangular area into several areas. You initialize the divider by |
420 | | - setting the horizontal and vertical list of sizes that the division |
421 | | - will be based on. You then use the new_locator method, whose return |
422 | | - value is a callable object that can be used to set the axes_locator |
423 | | - of the axes. |
| 417 | +* :class:`~mpl_toolkits.axes_grid1.axes_size.Divider` is the class |
| 418 | + that calculates the axes position. It divides the given |
| 419 | + rectangular area into several areas. The divider is initialized by |
| 420 | + setting the lists of horizontal and vertical sizes on which the division |
| 421 | + will be based. Then use |
| 422 | + :meth:`~mpl_toolkits.axes_grid1.axes_size.Divider.new_locator`, |
| 423 | + which returns a callable object that can be used to set the |
| 424 | + axes_locator of the axes. |
424 | 425 |
|
425 | 426 |
|
426 | | -You first initialize the divider by specifying its grids, i.e., |
| 427 | +First, initialize the divider by specifying its grids, i.e., |
427 | 428 | horizontal and vertical. |
428 | 429 |
|
429 | 430 | for example,:: |
|
454 | 455 | * v2 => 3, 0 |
455 | 456 |
|
456 | 457 | The height of the bottom row is always 2 (axes_divider internally |
457 | | -assumes that the unit is inch). The first and the second rows with |
458 | | -height ratio of 2:3. For example, if the total height of the grid 6, |
| 458 | +assumes that the unit is inches). The first and the second rows have a |
| 459 | +height ratio of 2:3. For example, if the total height of the grid is 6, |
459 | 460 | then the first and second row will each occupy 2/(2+3) and 3/(2+3) of |
460 | | -(6-1) inches. The widths of columns (horiz) will be similarly |
461 | | -determined. When aspect ratio is set, the total height (or width) will |
| 461 | +(6-1) inches. The widths of the horizontal columns will be similarly |
| 462 | +determined. When the aspect ratio is set, the total height (or width) will |
462 | 463 | be adjusted accordingly. |
463 | 464 |
|
464 | 465 |
|
465 | 466 | The :mod:`mpl_toolkits.axes_grid1.axes_size` contains several classes |
466 | 467 | that can be used to set the horizontal and vertical configurations. For |
467 | | -example, for the vertical configuration above will be:: |
| 468 | +example, for vertical configuration one could use:: |
468 | 469 |
|
469 | 470 | from mpl_toolkits.axes_grid1.axes_size import Fixed, Scaled |
470 | 471 | vert = [Fixed(2), Scaled(2), Scaled(3)] |
471 | 472 |
|
472 | 473 | After you set up the divider object, then you create a locator |
473 | | -instance which will be given to the axes.:: |
| 474 | +instance that will be given to the axes object.:: |
474 | 475 |
|
475 | 476 | locator = divider.new_locator(nx=0, ny=1) |
476 | 477 | ax.set_axes_locator(locator) |
477 | 478 |
|
478 | | -The return value of the new_locator method is a instance of the |
| 479 | +The return value of the new_locator method is an instance of the |
479 | 480 | AxesLocator class. It is a callable object that returns the |
480 | 481 | location and size of the cell at the first column and the second row. |
481 | 482 | You may create a locator that spans over multiple cells.:: |
482 | 483 |
|
483 | 484 | locator = divider.new_locator(nx=0, nx=2, ny=1) |
484 | 485 |
|
485 | 486 | The above locator, when called, will return the position and size of |
486 | | -the cells spanning the first and second column and the first row. You |
487 | | -may consider it as [0:2, 1]. |
| 487 | +the cells spanning the first and second column and the first row. In |
| 488 | +this example, it will return [0:2, 1]. |
488 | 489 |
|
489 | 490 | See the example, |
490 | 491 |
|
|
495 | 496 |
|
496 | 497 | Simple Axes Divider2 |
497 | 498 |
|
498 | | -You can adjust the size of the each axes according to their x or y |
499 | | -data limits (AxesX and AxesY), similar to the axes aspect parameter. |
| 499 | +You can adjust the size of each axes according to its x or y |
| 500 | +data limits (AxesX and AxesY). |
500 | 501 |
|
501 | 502 | .. figure:: ../../gallery/axes_grid1/images/sphx_glr_simple_axes_divider3_001.png |
502 | 503 | :target: ../../gallery/axes_grid1/simple_axes_divider3.html |
|
0 commit comments