Skip to content

Commit 5dfe709

Browse files
authored
Merge branch 'matplotlib:main' into lasso_demo
2 parents dd03d4a + 6820797 commit 5dfe709

File tree

11 files changed

+34
-32
lines changed

11 files changed

+34
-32
lines changed
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.

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 = []

lib/matplotlib/axes/_axes.py

Lines changed: 4 additions & 3 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

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/streamplot.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,8 +198,13 @@ def streamplot(axes, x, y, u, v, density=1, linewidth=None, color=None,
198198
tx += grid.x_origin
199199
ty += grid.y_origin
200200

201-
points = np.transpose([tx, ty]).reshape(-1, 1, 2)
202-
streamlines.extend(np.hstack([points[:-1], points[1:]]))
201+
# Create multiple tiny segments if varying width or color is given
202+
if isinstance(linewidth, np.ndarray) or use_multicolor_lines:
203+
points = np.transpose([tx, ty]).reshape(-1, 1, 2)
204+
streamlines.extend(np.hstack([points[:-1], points[1:]]))
205+
else:
206+
points = np.transpose([tx, ty])
207+
streamlines.append(points)
203208

204209
# Add arrows halfway along each trajectory.
205210
s = np.cumsum(np.hypot(np.diff(tx), np.diff(ty)))
-854 Bytes
Loading
-2.31 KB
Loading
-2.62 KB
Loading
-1.73 KB
Loading

0 commit comments

Comments
 (0)