Diagrams from Python, exported to Confluence

confluence
productivity
quarto
Published

April 24, 2024

Final test in this series, can I include a diagram drawn with Python?

The answer is yes, but I need to render the site first before publishing to Confluence.


format: html: code-fold: true jupyter: python3


For a demonstration of a line plot on a polar axis, see Figure 1.

Code
import numpy as np
import matplotlib.pyplot as plt

r = np.arange(0, 2, 0.01)
theta = 2 * np.pi * r
fig, ax = plt.subplots(
  subplot_kw = {'projection': 'polar'} 
)
ax.plot(theta, r)
ax.set_rticks([0.5, 1, 1.5, 2])
ax.grid(True)
plt.show()
Figure 1: A line plot on a polar axis