@@ -103,16 +103,13 @@ impl From<&ImportError> for Error {
103103 }
104104}
105105
106- /// A dict-like key-value store for config parameters, including
107- /// validation.
108- ///
109- /// Validating functions are defined and associated with rc parameters
110- /// in [`rcsetup`].
106+ /// A dict-like key-value store for config parameters.
111107#[ derive( Debug ) ]
112108pub struct RcParams {
113109 rc : Py < PyDict > ,
114110}
115111
112+ /// Rust types that may be used as [`RcParams`] values.
116113pub trait RcParamsValue {
117114 fn into_py < ' py > ( & self , py : Python < ' py > ) -> impl IntoPyObject < ' py > ;
118115}
@@ -146,6 +143,12 @@ impl RcParams {
146143 } )
147144 }
148145
146+ /// Set the [RcParam][] `key` to `value`.
147+ ///
148+ /// Note that an improper value may only raise an error later such
149+ /// as when [`pyplot::figure`] is called.
150+ ///
151+ /// [RcParam]: https://matplotlib.org/stable/api/matplotlib_configuration_api.html#matplotlib.RcParams
149152 pub fn set < ' py > ( & self , key : & str , value : impl RcParamsValue ) -> Result < ( ) , Error > {
150153 Python :: attach ( |py| -> Result < _ , Error > {
151154 self . rc . bind ( py) . set_item ( key, value. into_py ( py) )
@@ -167,6 +170,10 @@ impl RcParams {
167170 }
168171}
169172
173+ /// Return an instance of [`RcParams`] for handling default Matplotlib
174+ /// values.
175+ ///
176+ /// Setting values must be done before the figure is created.
170177pub fn rc_params ( ) -> & ' static RcParams {
171178 static RCPARAMS : PyOnceLock < RcParams > = PyOnceLock :: new ( ) ;
172179 Python :: attach ( |py| {
0 commit comments