|
312 | 312 | # |
313 | 313 | # .. _transforms-fig-scale-dpi: |
314 | 314 | # |
315 | | -# Plotting in physical units |
316 | | -# ========================== |
| 315 | +# Plotting in physical coordinates |
| 316 | +# ================================ |
317 | 317 | # |
318 | 318 | # Sometimes we want an object to be a certain physical size on the plot. |
319 | | -# Here we draw the same circle as above, but in physical units. If done |
| 319 | +# Here we draw the same circle as above, but in physical coordinates. If done |
320 | 320 | # interactively, you can see that changing the size of the figure does |
321 | 321 | # not change the offset of the circle from the lower-left corner, |
322 | 322 | # does not change its size, and the circle remains a circle regardless of |
|
325 | 325 | fig, ax = plt.subplots(figsize=(5, 4)) |
326 | 326 | x, y = 10*np.random.rand(2, 1000) |
327 | 327 | ax.plot(x, y*10., 'go', alpha=0.2) # plot some data in data coordinates |
328 | | -# add a circle in fixed-units |
| 328 | +# add a circle in fixed-coordinates |
329 | 329 | circ = mpatches.Circle((2.5, 2), 1.0, transform=fig.dpi_scale_trans, |
330 | 330 | facecolor='blue', alpha=0.75) |
331 | 331 | ax.add_patch(circ) |
|
338 | 338 | fig, ax = plt.subplots(figsize=(7, 2)) |
339 | 339 | x, y = 10*np.random.rand(2, 1000) |
340 | 340 | ax.plot(x, y*10., 'go', alpha=0.2) # plot some data in data coordinates |
341 | | -# add a circle in fixed-units |
| 341 | +# add a circle in fixed-coordinates |
342 | 342 | circ = mpatches.Circle((2.5, 2), 1.0, transform=fig.dpi_scale_trans, |
343 | 343 | facecolor='blue', alpha=0.75) |
344 | 344 | ax.add_patch(circ) |
|
416 | 416 | # |
417 | 417 | # Here we apply the transforms in the *opposite* order to the use of |
418 | 418 | # :class:`~matplotlib.transforms.ScaledTranslation` above. The plot is |
419 | | -# first made in data units (``ax.transData``) and then shifted by |
| 419 | +# first made in data coordinates (``ax.transData``) and then shifted by |
420 | 420 | # ``dx`` and ``dy`` points using ``fig.dpi_scale_trans``. (In typography, |
421 | 421 | # a `point <https://en.wikipedia.org/wiki/Point_%28typography%29>`_ is |
422 | 422 | # 1/72 inches, and by specifying your offsets in points, your figure |
|
0 commit comments