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

Skip to content

Commit 015c997

Browse files
authored
Merge branch 'matplotlib:main' into hasans-matplotlib/main
2 parents b6400d2 + 6820797 commit 015c997

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+410
-280
lines changed

doc/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ clean:
2424
rm -rf "$(SOURCEDIR)/tutorials"
2525
rm -rf "$(SOURCEDIR)/savefig"
2626
rm -rf "$(SOURCEDIR)/sphinxext/__pycache__"
27+
rm -f $(SOURCEDIR)/_static/constrained_layout*.png
2728

2829
show:
2930
@python -c "import webbrowser; webbrowser.open_new_tab('file://$(shell pwd)/build/html/index.html')"
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Streamplot now draws streamlines as one piece if no width or no color variance
2+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3+
4+
Since there is no need to draw streamlines piece by piece if there is no color
5+
change or width change, now streamplot will draw each streamline in one piece.
6+
7+
The behavior for varying width or varying color is not changed, same logic is
8+
used for these kinds of streamplots.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
Functions in ``mpl_toolkits.mplot3d.proj3d``
2+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3+
4+
The function ``transform`` is just an alias for ``proj_transform``,
5+
use the latter instead.
6+
7+
The following functions are either unused (so no longer required in Matplotlib)
8+
or considered private. If you rely on them, please make a copy of the code,
9+
including all functions that starts with a ``_`` (considered private).
10+
11+
* ``ortho_transformation``
12+
* ``persp_transformation``
13+
* ``proj_points``
14+
* ``proj_trans_points``
15+
* ``rot_x``
16+
* ``rotation_about_vector``
17+
* ``view_transformation``

doc/conf.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,8 +252,9 @@ def matplotlib_reduced_latex_scraper(block, block_vars, gallery_conf,
252252

253253
def gallery_image_warning_filter(record):
254254
msg = record.msg
255-
for gallery_dir in sphinx_gallery_conf['gallery_dirs']:
256-
if msg.startswith(f'image file not readable: {gallery_dir}'):
255+
for pattern in (sphinx_gallery_conf['gallery_dirs'] +
256+
['_static/constrained_layout']):
257+
if msg.startswith(f'image file not readable: {pattern}'):
257258
return False
258259

259260
if msg == 'Could not obtain image size. :scale: option is ignored.':

doc/devel/contributing.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ Contributor incubator
3838
The incubator is our non-public communication channel for new contributors. It
3939
is a private gitter room moderated by core Matplotlib developers where you can
4040
get guidance and support for your first few PRs. It's a place you can ask
41-
questions about anything: how to use git, github, how our PR review process
41+
questions about anything: how to use git, GitHub, how our PR review process
4242
works, technical questions about the code, what makes for good documentation
4343
or a blog post, how to get involved in community work, or get
4444
"pre-review" on your PR.
@@ -57,7 +57,7 @@ Among our attendees are fellow new contributors, as well as maintainers, and
5757
veteran contributors, who are keen to support onboarding of new folks and
5858
share their experience. You can find our community calendar link at the
5959
`Scientific Python website <https://scientific-python.org/calendars/>`_, and
60-
you can browse previous meeting notes on `github
60+
you can browse previous meeting notes on `GitHub
6161
<https://github.com/matplotlib/ProjectManagement/tree/master/
6262
new_contributor_meeting>`_.
6363
We recommend joining the meeting to clarify any doubts, or lingering

doc/devel/dependencies.rst

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -214,10 +214,13 @@ Matplotlib requires a C++ compiler that supports C++11.
214214

215215
- `gcc 4.8.1 <https://gcc.gnu.org/projects/cxx-status.html#cxx11>`_ or higher. For gcc <6.5 you will
216216
need to set ``$CFLAGS=-std=c++11`` to enable C++11 support.
217-
- `clang 3.3 <https://clang.llvm.org/cxx_status.html>`_ or higher
217+
`Installing GCC: Binaries <https://gcc.gnu.org/install/binaries.html>`_.
218+
- `clang 3.3 <https://clang.llvm.org/cxx_status.html>`_ or higher.
219+
`LLVM Download Page <https://releases.llvm.org/download.html>`_.
218220
- `Visual Studio 2015
219221
<https://docs.microsoft.com/en-us/cpp/overview/visual-cpp-language-conformance?view=msvc-140>`_
220-
(aka VS 14.0) or higher
222+
(aka VS 14.0) or higher. A free version of Build Tools for Visual Studio is available for
223+
`download <https://visualstudio.microsoft.com/downloads/?q=build+tools>`_.
221224

222225

223226
.. _test-dependencies:
@@ -303,9 +306,10 @@ Additional external dependencies
303306
--------------------------------
304307
Required:
305308

306-
* a minimal working LaTeX distribution
309+
* a minimal working LaTeX distribution, e.g., `TeX Live <https://www.tug.org/texlive/>`_ or
310+
`MikTeX <https://miktex.org/>`_
307311
* `Graphviz <http://www.graphviz.org/download>`_
308-
* the following LaTeX packages (if your OS bundles TeXLive, the
312+
* the following LaTeX packages (if your OS bundles TeX Live, the
309313
"complete" version of the installer, e.g. "texlive-full" or "texlive-all",
310314
will often automatically include these packages):
311315

doc/devel/development_workflow.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ why you did it, we recommend the following:
2828
.. note::
2929

3030
It may sound strange, but deleting your own ``main`` branch can help reduce
31-
confusion about which branch you are on. See `deleting main on github`_ for
31+
confusion about which branch you are on. See `deleting main on GitHub`_ for
3232
details.
3333

34-
.. _deleting main on github: https://matthew-brett.github.io/pydagogue/gh_delete_master.html
34+
.. _deleting main on GitHub: https://matthew-brett.github.io/pydagogue/gh_delete_master.html
3535

3636
.. _update-mirror-main:
3737

@@ -134,7 +134,7 @@ In more detail
134134
description in the `tangled working copy problem`_. The
135135
`git commit <https://git-scm.com/docs/git-commit>`_ manual page might also be
136136
useful.
137-
#. To push the changes up to your forked repo on github, do a ``git
137+
#. To push the changes up to your forked repo on GitHub, do a ``git
138138
push``.
139139

140140
.. _why the -a flag?: http://gitready.com/beginner/2009/01/18/the-staging-area.html

doc/devel/maintainer_workflow.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ If there are only a few commits, consider rebasing to upstream::
5050
git rebase upstream-rw/main
5151

5252
Remember that, if you do a rebase, and push that, you'll have to close any
53-
github pull requests manually, because github will not be able to detect the
53+
GitHub pull requests manually, because GitHub will not be able to detect the
5454
changes have already been merged.
5555

5656
A long series of commits
@@ -61,7 +61,7 @@ If there are a longer series of related commits, consider a merge instead::
6161
git fetch upstream-rw
6262
git merge --no-ff upstream-rw/main
6363

64-
The merge will be detected by github, and should close any related pull requests
64+
The merge will be detected by GitHub, and should close any related pull requests
6565
automatically.
6666

6767
Note the ``--no-ff`` above. This forces git to make a merge commit, rather than

doc/devel/triage.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ Triaging operations for members of the core and triage teams
8787
In addition to the above, members of the core team and the triage team
8888
can do the following important tasks:
8989

90-
- Update labels for issues and PRs: see the list of `available github
90+
- Update labels for issues and PRs: see the list of `available GitHub
9191
labels <https://github.com/matplotlib/matplotlib/labels>`_.
9292

9393
- Triage issues:

examples/lines_bars_and_markers/horizontal_barchart_distribution.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def survey(results, category_names):
6060
r, g, b, _ = color
6161
text_color = 'white' if r * g * b < 0.5 else 'darkgrey'
6262
ax.bar_label(rects, label_type='center', color=text_color)
63-
ax.legend(ncol=len(category_names), bbox_to_anchor=(0, 1),
63+
ax.legend(ncols=len(category_names), bbox_to_anchor=(0, 1),
6464
loc='lower left', fontsize='small')
6565

6666
return fig, ax

examples/lines_bars_and_markers/scatter_custom_symbol.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@
3535
# %%
3636
# Using a custom path
3737
# -------------------
38-
# Alternatively, one can also pass a custom path of N vertices as a Nx2 array
39-
# of x, y values as *marker*.
38+
# Alternatively, one can also pass a custom path of N vertices as a (N, 2)
39+
# array of x, y values as *marker*.
4040

4141
# unit area ellipse
4242
rx, ry = 3., 1.
@@ -45,7 +45,7 @@
4545
verts = np.column_stack([rx / area * np.cos(theta), ry / area * np.sin(theta)])
4646

4747
x, y, s, c = np.random.rand(4, 30)
48-
s *= 10**2.
48+
s *= 100
4949

5050
fig, ax = plt.subplots()
5151
ax.scatter(x, y, s, c, marker=verts)

examples/lines_bars_and_markers/timeline.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
url = 'https://api.github.com/repos/matplotlib/matplotlib/releases'
2525
url += '?per_page=100'
26-
data = json.loads(urllib.request.urlopen(url, timeout=.4).read().decode())
26+
data = json.loads(urllib.request.urlopen(url, timeout=1).read().decode())
2727

2828
dates = []
2929
names = []

examples/text_labels_and_annotations/legend_demo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
for n in range(1, 5):
4848
ax0.plot(x, x**n, label=f"{n=}")
4949
leg = ax0.legend(loc="upper left", bbox_to_anchor=[0, 1],
50-
ncol=2, shadow=True, title="Legend", fancybox=True)
50+
ncols=2, shadow=True, title="Legend", fancybox=True)
5151
leg.get_title().set_color("red")
5252

5353
# Demonstrate some more complex labels.

examples/user_interfaces/mplcvd.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,5 +295,5 @@ def _setup_wx(tb):
295295
th = np.linspace(0, 2*np.pi, 1024)
296296
for j in [1, 2, 4, 6]:
297297
axd['lines'].plot(th, np.sin(th * j), label=f'$\\omega={j}$')
298-
axd['lines'].legend(ncol=2, loc='upper right')
298+
axd['lines'].legend(ncols=2, loc='upper right')
299299
plt.show()

examples/userdemo/simple_legend01.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# Place a legend above this subplot, expanding itself to
1616
# fully use the given bounding box.
1717
ax.legend(bbox_to_anchor=(0., 1.02, 1., .102), loc='lower left',
18-
ncol=2, mode="expand", borderaxespad=0.)
18+
ncols=2, mode="expand", borderaxespad=0.)
1919

2020
ax = fig.add_subplot(223)
2121
ax.plot([1, 2, 3], label="test1")

lib/matplotlib/axes/_axes.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3723,9 +3723,10 @@ def boxplot(self, x, notch=None, sym=None, vert=None, whis=None,
37233723
Draw a box and whisker plot.
37243724
37253725
The box extends from the first quartile (Q1) to the third
3726-
quartile (Q3) of the data, with a line at the median. The
3727-
whiskers extend from the box by 1.5x the inter-quartile range
3728-
(IQR). Flier points are those past the end of the whiskers.
3726+
quartile (Q3) of the data, with a line at the median.
3727+
The whiskers extend from the box to the farthest data point
3728+
lying within 1.5x the inter-quartile range (IQR) from the box.
3729+
Flier points are those past the end of the whiskers.
37293730
See https://en.wikipedia.org/wiki/Box_plot for reference.
37303731
37313732
.. code-block:: none
@@ -6220,9 +6221,6 @@ def pcolormesh(self, *args, alpha=None, norm=None, cmap=None, vmin=None,
62206221
X, Y, C, shading = self._pcolorargs('pcolormesh', *args,
62216222
shading=shading, kwargs=kwargs)
62226223
coords = np.stack([X, Y], axis=-1)
6223-
# convert to one dimensional array, except for 3D RGB(A) arrays
6224-
if C.ndim != 3:
6225-
C = C.ravel()
62266224

62276225
kwargs.setdefault('snap', mpl.rcParams['pcolormesh.snap'])
62286226

lib/matplotlib/axes/_base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2495,7 +2495,7 @@ def update_datalim(self, xys, updatex=True, updatey=True):
24952495
----------
24962496
xys : 2D array-like
24972497
The points to include in the data limits Bbox. This can be either
2498-
a list of (x, y) tuples or a Nx2 array.
2498+
a list of (x, y) tuples or a (N, 2) array.
24992499
25002500
updatex, updatey : bool, default: True
25012501
Whether to update the x/y limits.

lib/matplotlib/axis.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1374,12 +1374,8 @@ def draw(self, renderer, *args, **kwargs):
13741374
for tick in ticks_to_draw:
13751375
tick.draw(renderer)
13761376

1377-
# Scale up the axis label box to also find the neighbors, not just the
1378-
# tick labels that actually overlap. We need a *copy* of the axis
1379-
# label box because we don't want to scale the actual bbox.
1380-
1377+
# Shift label away from axes to avoid overlapping ticklabels.
13811378
self._update_label_position(renderer)
1382-
13831379
self.label.draw(renderer)
13841380

13851381
self._update_offset_text_position(tlb1, tlb2)

lib/matplotlib/backends/_backend_tk.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ def _blit(argsid):
6161
the ``_blit_args`` dict, since arguments cannot be passed directly.
6262
"""
6363
photoimage, dataptr, offsets, bboxptr, comp_rule = _blit_args.pop(argsid)
64+
if not photoimage.tk.call("info", "commands", photoimage):
65+
return
6466
_tkagg.blit(photoimage.tk.interpaddr(), str(photoimage), dataptr,
6567
comp_rule, offsets, bboxptr)
6668

lib/matplotlib/backends/backend_qt.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -789,7 +789,7 @@ def save_figure(self, *args):
789789
filters.append(filter)
790790
filters = ';;'.join(filters)
791791

792-
fname, filter = qt_compat._getSaveFileName(
792+
fname, filter = QtWidgets.QFileDialog.getSaveFileName(
793793
self.canvas.parent(), "Choose a filename to save to", start,
794794
filters, selectedFilter)
795795
if fname:

lib/matplotlib/backends/qt_compat.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969

7070
def _setup_pyqt5plus():
7171
global QtCore, QtGui, QtWidgets, __version__
72-
global _getSaveFileName, _isdeleted, _to_int
72+
global _isdeleted, _to_int
7373

7474
if QT_API == QT_API_PYQT6:
7575
from PyQt6 import QtCore, QtGui, QtWidgets, sip
@@ -107,7 +107,6 @@ def _isdeleted(obj):
107107
_to_int = int
108108
else:
109109
raise AssertionError(f"Unexpected QT_API: {QT_API}")
110-
_getSaveFileName = QtWidgets.QFileDialog.getSaveFileName
111110

112111

113112
if QT_API in [QT_API_PYQT6, QT_API_PYQT5, QT_API_PYSIDE6, QT_API_PYSIDE2]:

lib/matplotlib/colors.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1110,8 +1110,8 @@ class ListedColormap(Colormap):
11101110
Parameters
11111111
----------
11121112
colors : list, array
1113-
List of Matplotlib color specifications, or an equivalent Nx3 or Nx4
1114-
floating point array (*N* RGB or RGBA values).
1113+
Sequence of Matplotlib color specifications (color names or RGB(A)
1114+
values).
11151115
name : str, optional
11161116
String to identify the colormap.
11171117
N : int, optional
@@ -2370,8 +2370,8 @@ def shade(self, data, cmap, norm=None, blend_mode='overlay', vmin=None,
23702370
"overlay". Note that for most topographic surfaces,
23712371
"overlay" or "soft" appear more visually realistic. If a
23722372
user-defined function is supplied, it is expected to
2373-
combine an MxNx3 RGB array of floats (ranging 0 to 1) with
2374-
an MxNx1 hillshade array (also 0 to 1). (Call signature
2373+
combine an (M, N, 3) RGB array of floats (ranging 0 to 1) with
2374+
an (M, N, 1) hillshade array (also 0 to 1). (Call signature
23752375
``func(rgb, illum, **kwargs)``) Additional kwargs supplied
23762376
to this function will be passed on to the *blend_mode*
23772377
function.
@@ -2404,7 +2404,7 @@ def shade(self, data, cmap, norm=None, blend_mode='overlay', vmin=None,
24042404
Returns
24052405
-------
24062406
`~numpy.ndarray`
2407-
An MxNx4 array of floats ranging between 0-1.
2407+
An (M, N, 4) array of floats ranging between 0-1.
24082408
"""
24092409
if vmin is None:
24102410
vmin = data.min()
@@ -2445,8 +2445,8 @@ def shade_rgb(self, rgb, elevation, fraction=1., blend_mode='hsv',
24452445
defaults to "hsv". Note that for most topographic surfaces,
24462446
"overlay" or "soft" appear more visually realistic. If a
24472447
user-defined function is supplied, it is expected to combine an
2448-
MxNx3 RGB array of floats (ranging 0 to 1) with an MxNx1 hillshade
2449-
array (also 0 to 1). (Call signature
2448+
(M, N, 3) RGB array of floats (ranging 0 to 1) with an (M, N, 1)
2449+
hillshade array (also 0 to 1). (Call signature
24502450
``func(rgb, illum, **kwargs)``)
24512451
Additional kwargs supplied to this function will be passed on to
24522452
the *blend_mode* function.
@@ -2512,9 +2512,9 @@ def blend_hsv(self, rgb, intensity, hsv_max_sat=None, hsv_max_val=None,
25122512
Parameters
25132513
----------
25142514
rgb : `~numpy.ndarray`
2515-
An MxNx3 RGB array of floats ranging from 0 to 1 (color image).
2515+
An (M, N, 3) RGB array of floats ranging from 0 to 1 (color image).
25162516
intensity : `~numpy.ndarray`
2517-
An MxNx1 array of floats ranging from 0 to 1 (grayscale image).
2517+
An (M, N, 1) array of floats ranging from 0 to 1 (grayscale image).
25182518
hsv_max_sat : number, default: 1
25192519
The maximum saturation value that the *intensity* map can shift the
25202520
output image to.
@@ -2531,7 +2531,7 @@ def blend_hsv(self, rgb, intensity, hsv_max_sat=None, hsv_max_val=None,
25312531
Returns
25322532
-------
25332533
`~numpy.ndarray`
2534-
An MxNx3 RGB array representing the combined images.
2534+
An (M, N, 3) RGB array representing the combined images.
25352535
"""
25362536
# Backward compatibility...
25372537
if hsv_max_sat is None:
@@ -2574,14 +2574,14 @@ def blend_soft_light(self, rgb, intensity):
25742574
Parameters
25752575
----------
25762576
rgb : `~numpy.ndarray`
2577-
An MxNx3 RGB array of floats ranging from 0 to 1 (color image).
2577+
An (M, N, 3) RGB array of floats ranging from 0 to 1 (color image).
25782578
intensity : `~numpy.ndarray`
2579-
An MxNx1 array of floats ranging from 0 to 1 (grayscale image).
2579+
An (M, N, 1) array of floats ranging from 0 to 1 (grayscale image).
25802580
25812581
Returns
25822582
-------
25832583
`~numpy.ndarray`
2584-
An MxNx3 RGB array representing the combined images.
2584+
An (M, N, 3) RGB array representing the combined images.
25852585
"""
25862586
return 2 * intensity * rgb + (1 - 2 * intensity) * rgb**2
25872587

@@ -2592,14 +2592,14 @@ def blend_overlay(self, rgb, intensity):
25922592
Parameters
25932593
----------
25942594
rgb : `~numpy.ndarray`
2595-
An MxNx3 RGB array of floats ranging from 0 to 1 (color image).
2595+
An (M, N, 3) RGB array of floats ranging from 0 to 1 (color image).
25962596
intensity : `~numpy.ndarray`
2597-
An MxNx1 array of floats ranging from 0 to 1 (grayscale image).
2597+
An (M, N, 1) array of floats ranging from 0 to 1 (grayscale image).
25982598
25992599
Returns
26002600
-------
26012601
ndarray
2602-
An MxNx3 RGB array representing the combined images.
2602+
An (M, N, 3) RGB array representing the combined images.
26032603
"""
26042604
low = 2 * intensity * rgb
26052605
high = 1 - 2 * (1 - intensity) * (1 - rgb)

0 commit comments

Comments
 (0)