API Reference
Displaying an accessible and interactive plot with multimodal formats
Plots generated by matplotlib, seaborn, Plotly, Bokeh, plotnine or Altair can be displayed in MAIDR format. Pass the plot object to maidr.show(), or call plt.show() after import maidr and let the custom backend do it.
| show | Display a MAIDR plot. |
| render | Render a MAIDR plot to HTML. |
| Maidr.show | Preview the HTML content using the specified renderer. |
Saving a maidr plot as an HTML file
Save a plot as a standalone HTML file with maidr.save_html().
| save_html | Save a MAIDR plot as HTML file. |
| Maidr.save_html | Save the HTML representation of the figure with MAIDR to a file. |
Reading the charts of an Excel workbook
Read every chart of an .xlsx workbook with maidr.read_excel_charts(), and pass a chart it returns to maidr.show(), maidr.render() or maidr.save_html(). Experimental.
| read_excel_charts | Read every chart in an Excel workbook. |
| excel.ExcelChart | One chart of an Excel workbook, drawn and ready for maidr. |
Reading the charts of a PowerPoint presentation or a Word document
Read every chart of a .pptx presentation with maidr.read_powerpoint_charts(), or of a .docx document with maidr.read_word_charts(), and pass a chart either returns to maidr.show(), maidr.render() or maidr.save_html(). Experimental.
| read_powerpoint_charts | Read every chart in a PowerPoint presentation. |
| office.PowerPointChart | One chart of a PowerPoint presentation, drawn and ready for maidr. |
| read_word_charts | Read every chart in a Word document. |
| office.WordChart | One chart of a Word document, drawn and ready for maidr. |
Reading the charts of a TensorBoard log directory
Read the scalars Keras, TensorFlow and PyTorch log with maidr.read_tensorboard_scalars(), one chart per tag, and their histograms with maidr.read_tensorboard_distributions() and maidr.read_tensorboard_histograms(), one chart per tag and run, a hyperparameter sweep with maidr.read_tensorboard_hparams(), and the Embedding Projector with maidr.read_tensorboard_projector(), PR curves with maidr.read_tensorboard_pr_curves(), a profile’s step-time graph and top operations with maidr.read_tensorboard_profile(), the Keras model graph with maidr.read_tensorboard_graph(), and pass a chart any of them returns to maidr.show(), maidr.render() or maidr.save_html(); or read the values themselves with maidr.tensorboard.load_scalars() and maidr.tensorboard.load_histograms(). Experimental.
| read_tensorboard_scalars | Read the scalar charts of a TensorBoard log directory. |
| tensorboard.TensorBoardChart | One tag of a TensorBoard log directory, drawn and ready for maidr. |
| tensorboard.load_scalars | Read the scalars of a TensorBoard log directory. |
| tensorboard.ScalarSeries | The values one run logged under one tag, in the order TensorBoard keeps. |
| tensorboard.smooth | Smooth values the way TensorBoard’s Scalars dashboard does. |
| read_tensorboard_distributions | Read the distribution charts of a TensorBoard log directory. |
| read_tensorboard_histograms | Read the histogram charts of a TensorBoard log directory, as ridgelines. |
| tensorboard.load_histograms | Read the histograms of a TensorBoard log directory. |
| tensorboard.HistogramSeries | The histograms one run logged under one tag, in the order TensorBoard keeps. |
| read_tensorboard_hparams | Read a hyperparameter sweep as its parallel coordinates and scatter matrix. |
| tensorboard.load_hparams | Read the sessions of a hyperparameter sweep. |
| tensorboard.Session | One training session of a sweep. |
| read_tensorboard_projector | Read the embeddings of a Projector log directory as 2D scatter plots. |
| read_tensorboard_pr_curves | Read the PR curve charts of a TensorBoard log directory. |
| tensorboard.load_pr_curves | Read the PR curve summaries of a TensorBoard log directory. |
| tensorboard.PRCurveSeries | The PR curves one run logged under one tag, step by step. |
| read_tensorboard_profile | Read a profiling session as its step-time graph and top operations. |
| tensorboard.profile.find_profiles | The profiling sessions of a log directory and their XPlane files. |
| tensorboard.profile.profile_charts | Draw the charts from the profile plugin’s converted tables. |
| tensorboard.load_embeddings | Read the embeddings a Projector log directory configures. |
| tensorboard.Embedding | One embedding of a Projector log directory. |
| read_tensorboard_graph | Read the Keras model graphs of a TensorBoard log directory. |
Drawing the training curves and graph of a Keras model
Draw what model.fit returns with maidr.keras.plot_history() and a classifier’s confusion matrix with maidr.keras.plot_confusion_matrix(), a binary classifier’s precision-recall curve with maidr.keras.plot_pr_curve(), its layers with maidr.keras.plot_model(), or keep an accessible page up to date while the model trains with maidr.keras.MaidrCallback. Import maidr.keras to use them. Experimental.
| plot_history | Draw the training curves of a Keras model. |
| plot_confusion_matrix | Draw a classifier’s confusion matrix as a heatmap. |
| plot_pr_curve | Draw a binary classifier’s precision-recall curve from its predictions. |
| plot_model | Draw a Keras model’s layers as a directed graph. |
| MaidrCallback | Keep an accessible page of a model’s training curves while it trains. |
Reading the training curves of Weights & Biases runs
Read the metrics W&B runs logged with maidr.read_wandb_history(), one chart per metric with a line per run, from the runs’ own files or from the W&B server, and pass a chart it returns to maidr.show(), maidr.render() or maidr.save_html(); or read the values themselves with maidr.wandb.load_wandb_history(). Experimental.
| read_wandb_history | Read the training curves of Weights & Biases runs. |
| wandb.load_wandb_history | Read the metrics Weights & Biases runs logged. |
| wandb.MetricChart | One metric of one or more training runs, drawn and ready for maidr. |
| wandb.MetricSeries | The values one run logged under one metric, in step order. |
Reading the training curves of MLflow runs
Read the metrics MLflow runs logged with maidr.read_mlflow_metrics(), one chart per metric with a line per run, and store an accessible chart in a run, where the MLflow UI shows it, with maidr.log_mlflow_chart(); or read the values themselves with maidr.mlflow.load_mlflow_metrics(). Requires MLflow: pip install "maidr[mlflow]". Experimental.
| read_mlflow_metrics | Read the training curves of MLflow runs. |
| log_mlflow_chart | Store an accessible chart in an MLflow run, as an HTML artifact. |
| mlflow.load_mlflow_metrics | Read the metrics MLflow runs logged. |
Registering and releasing figures
Mark a bar container as a stacked bar plot with maidr.stacked(), and release the figures maidr tracks with maidr.close().
| stacked | |
| close | Close a MAIDR plot and clean up resources. |
Switching the matplotlib backend
Control whether plt.show() uses the maidr accessible backend or the platform default with maidr.set_backend().
| set_backend | Switch the matplotlib backend between maidr and the platform default. |
Where the maidr.js runtime comes from
Choose between the jsDelivr CDN and the copy bundled in the wheel with maidr.set_use_cdn(), name where the bundled copy finds its non-English locale packs with maidr.set_locale_base_url(), and emit the notebook loader by hand with maidr.init_notebook().
| set_use_cdn | Set the process-wide default for use_cdn. |
| get_use_cdn | Return the current default for use_cdn. |
| set_locale_base_url | Set where documents running the bundled maidr.js find locale packs. |
| get_locale_base_url | Return where a document running the bundled maidr.js finds packs. |
| init_notebook | Inject the bundled maidr.js / maidr-math.css into the notebook DOM. |
Shiny for Python
Pair output_maidr() in the UI with @render_maidr in the server. Requires the shiny extra: pip install "maidr[shiny]".
| shiny.output_maidr | Create a container for a :class:render_maidr output. |
| shiny.render_maidr | Render a plot as an accessible MAIDR chart in a Shiny app. |
Streamlit
Place an accessible chart in a Streamlit app with render_maidr(), or get the HTML string to cache with maidr_html(). Requires the streamlit extra: pip install "maidr[streamlit]".
| streamlit.render_maidr | Draw an accessible MAIDR chart in a Streamlit app. |
| streamlit.maidr_html | Return an accessible chart as a self-contained HTML string. |
Gradio
Place an accessible chart in a Gradio app with output_maidr(), and return render_maidr() from an event handler to replace it. Requires the gradio extra: pip install "maidr[gradio]".
| gradio.output_maidr | Make a gr.HTML component holding an accessible chart. |
| gradio.render_maidr | Return the markup of an accessible chart, for a gr.HTML component. |