MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / create_icon_axes

Function create_icon_axes

galleries/examples/misc/logos2.py:38–90  ·  view source on GitHub ↗

Create a polar Axes containing the matplotlib radar plot. Parameters ---------- fig : matplotlib.figure.Figure The figure to draw into. ax_position : (float, float, float, float) The position of the created Axes in figure coordinates as (x, y, width, hei

(fig, ax_position, lw_bars, lw_grid, lw_border, rgrid)

Source from the content-addressed store, hash-verified

36
37
38def create_icon_axes(fig, ax_position, lw_bars, lw_grid, lw_border, rgrid):
39 """
40 Create a polar Axes containing the matplotlib radar plot.
41
42 Parameters
43 ----------
44 fig : matplotlib.figure.Figure
45 The figure to draw into.
46 ax_position : (float, float, float, float)
47 The position of the created Axes in figure coordinates as
48 (x, y, width, height).
49 lw_bars : float
50 The linewidth of the bars.
51 lw_grid : float
52 The linewidth of the grid.
53 lw_border : float
54 The linewidth of the Axes border.
55 rgrid : array-like
56 Positions of the radial grid.
57
58 Returns
59 -------
60 ax : matplotlib.axes.Axes
61 The created Axes.
62 """
63 with plt.rc_context({'axes.edgecolor': MPL_BLUE,
64 'axes.linewidth': lw_border}):
65 ax = fig.add_axes(ax_position, projection='polar')
66 ax.set_axisbelow(True)
67
68 N = 7
69 arc = 2. * np.pi
70 theta = np.arange(0.0, arc, arc / N)
71 radii = np.array([2, 6, 8, 7, 4, 5, 8])
72 width = np.pi / 4 * np.array([0.4, 0.4, 0.6, 0.8, 0.2, 0.5, 0.3])
73 bars = ax.bar(theta, radii, width=width, bottom=0.0, align='edge',
74 edgecolor='0.3', lw=lw_bars)
75 for r, bar in zip(radii, bars):
76 color = *cm.jet(r / 10.)[:3], 0.6 # color from jet with alpha=0.6
77 bar.set_facecolor(color)
78
79 ax.tick_params(labelbottom=False, labeltop=False,
80 labelleft=False, labelright=False)
81
82 ax.grid(lw=lw_grid, color='0.9')
83 ax.set_rmax(9)
84 ax.set_yticks(rgrid)
85
86 # the actual visible background - extends a bit beyond the axis
87 ax.add_patch(Rectangle((0, 0), arc, 9.58,
88 facecolor='white', zorder=0,
89 clip_on=False, in_layout=False))
90 return ax
91
92
93def create_text_axes(fig, height_px):

Callers 1

make_logoFunction · 0.85

Calls 10

RectangleClass · 0.90
add_axesMethod · 0.80
set_axisbelowMethod · 0.80
set_rmaxMethod · 0.80
set_yticksMethod · 0.80
add_patchMethod · 0.80
barMethod · 0.45
set_facecolorMethod · 0.45
tick_paramsMethod · 0.45
gridMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…