Thanks to visit codestin.com
Credit goes to github.com

Skip to content

DOC: Fix accidental cases of blockquotes #26447

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
183 changes: 91 additions & 92 deletions doc/api/prev_api_changes/api_changes_0.54.rst
Original file line number Diff line number Diff line change
Expand Up @@ -76,137 +76,136 @@ Object interface - Application programmers
Autoscaling
~~~~~~~~~~~

The x and y axis instances no longer have autoscale view. These are
handled by axes.autoscale_view
The x and y axis instances no longer have autoscale view. These are
handled by axes.autoscale_view

Axes creation
~~~~~~~~~~~~~

You should not instantiate your own Axes any more using the OO API.
Rather, create a Figure as before and in place of::
You should not instantiate your own Axes any more using the OO API.
Rather, create a Figure as before and in place of::

f = Figure(figsize=(5,4), dpi=100)
a = Subplot(f, 111)
f.add_axis(a)
f = Figure(figsize=(5,4), dpi=100)
a = Subplot(f, 111)
f.add_axis(a)

use::
use::

f = Figure(figsize=(5,4), dpi=100)
a = f.add_subplot(111)
f = Figure(figsize=(5,4), dpi=100)
a = f.add_subplot(111)

That is, add_axis no longer exists and is replaced by::
That is, add_axis no longer exists and is replaced by::

add_axes(rect, axisbg=defaultcolor, frameon=True)
add_subplot(num, axisbg=defaultcolor, frameon=True)
add_axes(rect, axisbg=defaultcolor, frameon=True)
add_subplot(num, axisbg=defaultcolor, frameon=True)

Artist methods
~~~~~~~~~~~~~~

If you define your own Artists, you need to rename the _draw method
to draw
If you define your own Artists, you need to rename the _draw method
to draw

Bounding boxes
~~~~~~~~~~~~~~

matplotlib.transforms.Bound2D is replaced by
matplotlib.transforms.Bbox. If you want to construct a bbox from
left, bottom, width, height (the signature for Bound2D), use
matplotlib.transforms.lbwh_to_bbox, as in
matplotlib.transforms.Bound2D is replaced by
matplotlib.transforms.Bbox. If you want to construct a bbox from
left, bottom, width, height (the signature for Bound2D), use
matplotlib.transforms.lbwh_to_bbox, as in::

bbox = clickBBox = lbwh_to_bbox(left, bottom, width, height)

The Bbox has a different API than the Bound2D. e.g., if you want to
get the width and height of the bbox
The Bbox has a different API than the Bound2D. e.g., if you want to
get the width and height of the bbox

OLD::
width = fig.bbox.x.interval()
height = fig.bbox.y.interval()
**OLD**::

New::
width = fig.bbox.width()
height = fig.bbox.height()
width = fig.bbox.x.interval()
height = fig.bbox.y.interval()

**NEW**::

width = fig.bbox.width()
height = fig.bbox.height()


Object constructors
~~~~~~~~~~~~~~~~~~~

You no longer pass the bbox, dpi, or transforms to the various
Artist constructors. The old way or creating lines and rectangles
was cumbersome because you had to pass so many attributes to the
Line2D and Rectangle classes not related directly to the geometry
and properties of the object. Now default values are added to the
object when you call axes.add_line or axes.add_patch, so they are
hidden from the user.
You no longer pass the bbox, dpi, or transforms to the various
Artist constructors. The old way or creating lines and rectangles
was cumbersome because you had to pass so many attributes to the
Line2D and Rectangle classes not related directly to the geometry
and properties of the object. Now default values are added to the
object when you call axes.add_line or axes.add_patch, so they are
hidden from the user.

If you want to define a custom transformation on these objects, call
o.set_transform(trans) where trans is a Transformation instance.
If you want to define a custom transformation on these objects, call
o.set_transform(trans) where trans is a Transformation instance.

In prior versions of you wanted to add a custom line in data coords,
you would have to do
In prior versions of you wanted to add a custom line in data coords,
you would have to do::

l = Line2D(dpi, bbox, x, y,
color = color,
transx = transx,
transy = transy,
)
l = Line2D(dpi, bbox, x, y,
color = color,
transx = transx,
transy = transy,
)

now all you need is
now all you need is::

l = Line2D(x, y, color=color)
l = Line2D(x, y, color=color)

and the axes will set the transformation for you (unless you have
set your own already, in which case it will eave it unchanged)
and the axes will set the transformation for you (unless you have
set your own already, in which case it will eave it unchanged)

Transformations
~~~~~~~~~~~~~~~

The entire transformation architecture has been rewritten.
Previously the x and y transformations where stored in the xaxis and
yaxis instances. The problem with this approach is it only allows
for separable transforms (where the x and y transformations don't
depend on one another). But for cases like polar, they do. Now
transformations operate on x,y together. There is a new base class
matplotlib.transforms.Transformation and two concrete
implementations, matplotlib.transforms.SeparableTransformation and
matplotlib.transforms.Affine. The SeparableTransformation is
constructed with the bounding box of the input (this determines the
rectangular coordinate system of the input, i.e., the x and y view
limits), the bounding box of the display, and possibly nonlinear
transformations of x and y. The 2 most frequently used
transformations, data coordinates -> display and axes coordinates ->
display are available as ax.transData and ax.transAxes. See
alignment_demo.py which uses axes coords.

Also, the transformations should be much faster now, for two reasons

* they are written entirely in extension code

* because they operate on x and y together, they can do the entire
transformation in one loop. Earlier I did something along the
lines of::

xt = sx*func(x) + tx
yt = sy*func(y) + ty

Although this was done in numerix, it still involves 6 length(x)
for-loops (the multiply, add, and function evaluation each for x
and y). Now all of that is done in a single pass.


If you are using transformations and bounding boxes to get the
cursor position in data coordinates, the method calls are a little
different now. See the updated examples/coords_demo.py which shows
you how to do this.

Likewise, if you are using the artist bounding boxes to pick items
on the canvas with the GUI, the bbox methods are somewhat
different. You will need to see the updated
examples/object_picker.py.

See unit/transforms_unit.py for many examples using the new
transformations.
The entire transformation architecture has been rewritten.
Previously the x and y transformations where stored in the xaxis and
yaxis instances. The problem with this approach is it only allows
for separable transforms (where the x and y transformations don't
depend on one another). But for cases like polar, they do. Now
transformations operate on x,y together. There is a new base class
matplotlib.transforms.Transformation and two concrete
implementations, matplotlib.transforms.SeparableTransformation and
matplotlib.transforms.Affine. The SeparableTransformation is
constructed with the bounding box of the input (this determines the
rectangular coordinate system of the input, i.e., the x and y view
limits), the bounding box of the display, and possibly nonlinear
transformations of x and y. The 2 most frequently used
transformations, data coordinates -> display and axes coordinates ->
display are available as ax.transData and ax.transAxes. See
alignment_demo.py which uses axes coords.

Also, the transformations should be much faster now, for two reasons

* they are written entirely in extension code

* because they operate on x and y together, they can do the entire
transformation in one loop. Earlier I did something along the
lines of::

xt = sx*func(x) + tx
yt = sy*func(y) + ty

Although this was done in numerix, it still involves 6 length(x)
for-loops (the multiply, add, and function evaluation each for x
and y). Now all of that is done in a single pass.

If you are using transformations and bounding boxes to get the
cursor position in data coordinates, the method calls are a little
different now. See the updated examples/coords_demo.py which shows
you how to do this.

Likewise, if you are using the artist bounding boxes to pick items
on the canvas with the GUI, the bbox methods are somewhat
different. You will need to see the updated
examples/object_picker.py.

See unit/transforms_unit.py for many examples using the new
transformations.


.. highlight:: none
59 changes: 24 additions & 35 deletions doc/api/prev_api_changes/api_changes_0.98.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -282,44 +282,33 @@ Old method New method

New methods:

* :meth:`draw_path(self, gc, path, transform, rgbFace)
<matplotlib.backend_bases.RendererBase.draw_path>`

* :meth:`draw_markers(self, gc, marker_path, marker_trans, path,
trans, rgbFace)
<matplotlib.backend_bases.RendererBase.draw_markers>`

* :meth:`draw_path_collection(self, master_transform, cliprect,
clippath, clippath_trans, paths, all_transforms, offsets,
offsetTrans, facecolors, edgecolors, linewidths, linestyles,
antialiaseds)
<matplotlib.backend_bases.RendererBase.draw_path_collection>`
*[optional]*
* :meth:`draw_path(self, gc, path, transform, rgbFace)
<matplotlib.backend_bases.RendererBase.draw_path>`
* :meth:`draw_markers(self, gc, marker_path, marker_trans, path,
trans, rgbFace)
<matplotlib.backend_bases.RendererBase.draw_markers>`
* :meth:`draw_path_collection(self, master_transform, cliprect,
clippath, clippath_trans, paths, all_transforms, offsets,
offsetTrans, facecolors, edgecolors, linewidths, linestyles,
antialiaseds)
<matplotlib.backend_bases.RendererBase.draw_path_collection>`
*[optional]*

Changed methods:

* ``draw_image(self, x, y, im, bbox)`` is now
:meth:`draw_image(self, x, y, im, bbox, clippath, clippath_trans)
<matplotlib.backend_bases.RendererBase.draw_image>`
* ``draw_image(self, x, y, im, bbox)`` is now
:meth:`draw_image(self, x, y, im, bbox, clippath, clippath_trans)
<matplotlib.backend_bases.RendererBase.draw_image>`

Removed methods:

* ``draw_arc``

* ``draw_line_collection``

* ``draw_line``

* ``draw_lines``

* ``draw_point``

* ``draw_quad_mesh``

* ``draw_poly_collection``

* ``draw_polygon``

* ``draw_rectangle``

* ``draw_regpoly_collection``
* ``draw_arc``
* ``draw_line_collection``
* ``draw_line``
* ``draw_lines``
* ``draw_point``
* ``draw_quad_mesh``
* ``draw_poly_collection``
* ``draw_polygon``
* ``draw_rectangle``
* ``draw_regpoly_collection``
19 changes: 9 additions & 10 deletions doc/api/prev_api_changes/api_changes_0.98.x.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,15 @@ Changes for 0.98.x
are given as a fraction of the font-size. Also, *scatteryoffsets*,
*fancybox* and *columnspacing* are added as keyword parameters.

================ ================
Deprecated New
================ ================
pad borderpad
labelsep labelspacing
handlelen handlelength
handlestextsep handletextpad
axespad borderaxespad
================ ================

================ ================
Deprecated New
================ ================
pad borderpad
labelsep labelspacing
handlelen handlelength
handlestextsep handletextpad
axespad borderaxespad
================ ================

* Removed the configobj and experimental traits rc support

Expand Down
Loading