Closed SamirAbboud closed 1 year ago
Sure this is possible use the ax argument:
import matplotlib.pyplot as plt
from mplsoccer import PyPizza
fig = plt.figure(figsize=(16, 8))
ax_1 = fig.add_subplot(121, projection='polar')
ax_2 = fig.add_subplot(122)
# parameter and value list
params = ['Speed', 'Agility', 'Strength', 'Passing', 'Dribbles']
values = [5, 2, 4, 3, 1]
# instantiate PyPizza class
baker = PyPizza(
params=params, # list of parameters
straight_line_color="#F2F2F2", # color for straight lines
straight_line_lw=1, # linewidth for straight lines
straight_line_limit=5.0, # max limit of straight lines
last_circle_lw=0, # linewidth of last circle
other_circle_lw=0, # linewidth for other circles
inner_circle_size=0.4, # size of inner circle
)
# plot pizza
baker.make_pizza(
values, # list of values
ax=ax_1,
color_blank_space="same", # use same color to fill blank space
blank_alpha=0.4, # alpha for blank-space colors
param_location=5.5, # where the parameters will be added
kwargs_slices=dict(
facecolor="cornflowerblue", edgecolor="#F2F2F2",
zorder=2, linewidth=1
), # values to be used when plotting slices
kwargs_params=dict(
color="#000000", fontsize=12,
va="center"
), # values to be used when adding parameter
kwargs_values=dict(
color="#000000", fontsize=12,
zorder=3,
bbox=dict(
edgecolor="#000000", facecolor="cornflowerblue",
boxstyle="round,pad=0.2", lw=1
)
) # values to be used when adding parameter-values
)
ax_2.pie([10, 30, 45, 15])
plt.show()
How Can I do the same: `fig = plt.figure(figsize=(16, 8))
ax_1 = fig.add_subplot(121) ax_1.pie([10, 30, 45, 15])
ax_2 = fig.add_subplot(122) ax_2.pie([10, 30, 45, 15])
plt.show()`