Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit51e8f7f

Browse files
trygvradtacaswellksunden
authored
New data → color pipeline (#28658)
This overhauls the data -> color pipeline used in ScalarMappable to open the path to higher-dimension mappings.Co-authored-by: Thomas A Caswell <tcaswell@gmail.com>Co-authored-by: Kyle Sunden <git@ksunden.space>
1 parented8131b commit51e8f7f

30 files changed

+1161
-514
lines changed

‎doc/api/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
scalarmappable.gen_rst

‎doc/api/cm_api.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,5 @@
66
:members:
77
:undoc-members:
88
:show-inheritance:
9+
10+
..include::scalarmappable.gen_rst

‎doc/api/colorizer_api.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
************************
2+
``matplotlib.colorizer``
3+
************************
4+
5+
..automodule::matplotlib.colorizer
6+
:members:
7+
:undoc-members:
8+
:show-inheritance:
9+
:private-members: _ColorizerInterface, _ScalarMappable

‎doc/api/colors_api.rst

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ Color norms
3232
SymLogNorm
3333
TwoSlopeNorm
3434

35-
Colormaps
36-
---------
35+
UnivariateColormaps
36+
--------------------
3737

3838
..autosummary::
3939
:toctree: _as_gen/
@@ -43,6 +43,17 @@ Colormaps
4343
LinearSegmentedColormap
4444
ListedColormap
4545

46+
Multivariate Colormaps
47+
----------------------
48+
49+
..autosummary::
50+
:toctree: _as_gen/
51+
:template: autosummary.rst
52+
53+
BivarColormap
54+
SegmentedBivarColormap
55+
BivarColormapFromImage
56+
4657
Other classes
4758
-------------
4859

‎doc/api/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ Alphabetical list of modules:
9393
cm_api.rst
9494
collections_api.rst
9595
colorbar_api.rst
96+
colorizer_api.rst
9697
colors_api.rst
9798
container_api.rst
9899
contour_api.rst

‎doc/conf.py

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929

3030
importmatplotlib
3131

32-
3332
# debug that building expected version
3433
print(f"Building Documentation for Matplotlib:{matplotlib.__version__}")
3534

@@ -853,6 +852,58 @@ def linkcode_resolve(domain, info):
853852
extensions.append('sphinx.ext.viewcode')
854853

855854

855+
defgenerate_ScalarMappable_docs():
856+
857+
importmatplotlib.colorizer
858+
fromnumpydoc.docscrape_sphinximportget_doc_object
859+
frompathlibimportPath
860+
importtextwrap
861+
fromsphinx.util.inspectimportstringify_signature
862+
target_file=Path(__file__).parent/'api'/'scalarmappable.gen_rst'
863+
withopen(target_file,'w')asfout:
864+
fout.write("""
865+
.. class:: ScalarMappable(colorizer, **kwargs)
866+
:canonical: matplotlib.colorizer._ScalarMappable
867+
868+
""")
869+
formethin [
870+
matplotlib.colorizer._ScalarMappable.autoscale,
871+
matplotlib.colorizer._ScalarMappable.autoscale_None,
872+
matplotlib.colorizer._ScalarMappable.changed,
873+
"""
874+
.. attribute:: colorbar
875+
876+
The last colorbar associated with this ScalarMappable. May be None.
877+
""",
878+
matplotlib.colorizer._ScalarMappable.get_alpha,
879+
matplotlib.colorizer._ScalarMappable.get_array,
880+
matplotlib.colorizer._ScalarMappable.get_clim,
881+
matplotlib.colorizer._ScalarMappable.get_cmap,
882+
"""
883+
.. property:: norm
884+
""",
885+
matplotlib.colorizer._ScalarMappable.set_array,
886+
matplotlib.colorizer._ScalarMappable.set_clim,
887+
matplotlib.colorizer._ScalarMappable.set_cmap,
888+
matplotlib.colorizer._ScalarMappable.set_norm,
889+
matplotlib.colorizer._ScalarMappable.to_rgba,
890+
]:
891+
ifisinstance(meth,str):
892+
fout.write(meth)
893+
else:
894+
name=meth.__name__
895+
sig=stringify_signature(inspect.signature(meth))
896+
docstring=textwrap.indent(
897+
str(get_doc_object(meth)),
898+
' '
899+
).rstrip()
900+
fout.write(f"""
901+
.. method::{name}{sig}
902+
{docstring}
903+
904+
""")
905+
906+
856907
# -----------------------------------------------------------------------------
857908
# Sphinx setup
858909
# -----------------------------------------------------------------------------
@@ -866,3 +917,4 @@ def setup(app):
866917
app.connect('autodoc-process-bases',autodoc_process_bases)
867918
ifsphinx.version_info[:2]< (7,1):
868919
app.connect('html-page-context',add_html_cache_busting,priority=1000)
920+
generate_ScalarMappable_docs()

‎doc/missing-references.json

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -306,8 +306,8 @@
306306
"lib/matplotlib/axes/_axes.py:docstring of matplotlib.axes._axes.Axes.broken_barh:84",
307307
"lib/matplotlib/axes/_axes.py:docstring of matplotlib.axes._axes.Axes.fill_between:121",
308308
"lib/matplotlib/axes/_axes.py:docstring of matplotlib.axes._axes.Axes.fill_betweenx:121",
309-
"lib/matplotlib/axes/_axes.py:docstring of matplotlib.axes._axes.Axes.hexbin:213",
310-
"lib/matplotlib/axes/_axes.py:docstring of matplotlib.axes._axes.Axes.pcolor:182",
309+
"lib/matplotlib/axes/_axes.py:docstring of matplotlib.axes._axes.Axes.hexbin:217",
310+
"lib/matplotlib/axes/_axes.py:docstring of matplotlib.axes._axes.Axes.pcolor:186",
311311
"lib/matplotlib/axes/_axes.py:docstring of matplotlib.axes._axes.Axes.quiver:215",
312312
"lib/matplotlib/collections.py:docstring of matplotlib.artist.AsteriskPolygonCollection.set:44",
313313
"lib/matplotlib/collections.py:docstring of matplotlib.artist.CircleCollection.set:44",
@@ -321,8 +321,8 @@
321321
"lib/matplotlib/pyplot.py:docstring of matplotlib.pyplot.broken_barh:84",
322322
"lib/matplotlib/pyplot.py:docstring of matplotlib.pyplot.fill_between:121",
323323
"lib/matplotlib/pyplot.py:docstring of matplotlib.pyplot.fill_betweenx:121",
324-
"lib/matplotlib/pyplot.py:docstring of matplotlib.pyplot.hexbin:213",
325-
"lib/matplotlib/pyplot.py:docstring of matplotlib.pyplot.pcolor:182",
324+
"lib/matplotlib/pyplot.py:docstring of matplotlib.pyplot.hexbin:217",
325+
"lib/matplotlib/pyplot.py:docstring of matplotlib.pyplot.pcolor:186",
326326
"lib/matplotlib/pyplot.py:docstring of matplotlib.pyplot.quiver:215",
327327
"lib/matplotlib/quiver.py:docstring of matplotlib.artist.Barbs.set:45",
328328
"lib/matplotlib/quiver.py:docstring of matplotlib.artist.Quiver.set:45",
@@ -332,10 +332,10 @@
332332
"lib/mpl_toolkits/mplot3d/art3d.py:docstring of matplotlib.artist.Poly3DCollection.set:45"
333333
],
334334
"matplotlib.collections._MeshData.set_array": [
335-
"lib/matplotlib/axes/_axes.py:docstring of matplotlib.axes._axes.Axes.pcolormesh:164",
335+
"lib/matplotlib/axes/_axes.py:docstring of matplotlib.axes._axes.Axes.pcolormesh:168",
336336
"lib/matplotlib/collections.py:docstring of matplotlib.artist.PolyQuadMesh.set:17",
337337
"lib/matplotlib/collections.py:docstring of matplotlib.artist.QuadMesh.set:17",
338-
"lib/matplotlib/pyplot.py:docstring of matplotlib.pyplot.pcolormesh:164"
338+
"lib/matplotlib/pyplot.py:docstring of matplotlib.pyplot.pcolormesh:168"
339339
]
340340
},
341341
"py:obj": {
@@ -355,12 +355,6 @@
355355
"Line2D.pick": [
356356
"doc/users/explain/figure/event_handling.rst:571"
357357
],
358-
"QuadContourSet.changed()": [
359-
"lib/matplotlib/axes/_axes.py:docstring of matplotlib.axes._axes.Axes.contour:156",
360-
"lib/matplotlib/axes/_axes.py:docstring of matplotlib.axes._axes.Axes.contourf:156",
361-
"lib/matplotlib/pyplot.py:docstring of matplotlib.pyplot.contour:156",
362-
"lib/matplotlib/pyplot.py:docstring of matplotlib.pyplot.contourf:156"
363-
],
364358
"Rectangle.contains": [
365359
"doc/users/explain/figure/event_handling.rst:285"
366360
],

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp