x <- c(35, 15, 20, 25)
names(x) <- c('蘭鋳', '出目金', '流金', '土佐金')
x
## 蘭鋳 出目金 流金 土佐金
## 35 15 20 25
# カラーパレット
COL <- c(rgb(255, 0, 255, 55, max = 255), # ピンク
rgb( 0, 0, 255, 55, max = 255)) # ラベンダ
pie(x, clockwise = T)

p <- x / sum(x) * 100
pie(p, labels = paste(names(p), round(p, 1), '%'), clockwise = T, main = 'ある金魚屋の売り上げ')
library(plotly)
## 要求されたパッケージ ggplot2 をロード中です
##
## 次のパッケージを付け加えます: 'plotly'
## 以下のオブジェクトは 'package:ggplot2' からマスクされています:
##
## last_plot
## 以下のオブジェクトは 'package:stats' からマスクされています:
##
## filter
## 以下のオブジェクトは 'package:graphics' からマスクされています:
##
## layout

plot_ly(type = 'pie', textinfo = 'label+percent', values = x, labels = names(x)) |>
layout(title = 'ある金魚屋の売り上げ')
import matplotlib.pyplot as plt
import numpy as np
x = np.array([5, 40, 25, 10])
labels = ['蘭鋳', '出目金', '流金', '土佐金' ]
plt.pie(x, labels = labels,
startangle = 90,
counterclock = False,
autopct = '%1.1f%%')
## ([<matplotlib.patches.Wedge object at 0x000001876C668B60>, <matplotlib.patches.Wedge object at 0x000001876C62D7F0>, <matplotlib.patches.Wedge object at 0x000001876C669550>, <matplotlib.patches.Wedge object at 0x000001876C669B80>], [Text(0.21459935421774118, 1.0788638084435536, '蘭鋳'), Text(1.0162674857624154, -0.4209517756015988, '出目金'), Text(-1.0788638084435536, -0.21459935421774148, '流金'), Text(-0.4209517756015994, 1.0162674857624152, '土佐金')], [Text(0.117054193209677, 0.5884711682419382, '6.2%'), Text(0.5543277195067721, -0.22961005941905385, '50.0%'), Text(-0.5884711682419382, -0.11705419320967717, '31.2%'), Text(-0.22961005941905419, 0.5543277195067718, '12.5%')])
plt.show()
## C:\Users\takum\AppData\Local\R\win-library\4.3\reticulate\python\rpytools\call.py:7: UserWarning: Glyph 34349 (\N{CJK UNIFIED IDEOGRAPH-862D}) missing from current font.
## value, error = rpycall.call_r_function(f, *args, **kwargs)
## C:\Users\takum\AppData\Local\R\win-library\4.3\reticulate\python\rpytools\call.py:7: UserWarning: Glyph 37619 (\N{CJK UNIFIED IDEOGRAPH-92F3}) missing from current font.
## value, error = rpycall.call_r_function(f, *args, **kwargs)
## C:\Users\takum\AppData\Local\R\win-library\4.3\reticulate\python\rpytools\call.py:7: UserWarning: Glyph 20986 (\N{CJK UNIFIED IDEOGRAPH-51FA}) missing from current font.
## value, error = rpycall.call_r_function(f, *args, **kwargs)
## C:\Users\takum\AppData\Local\R\win-library\4.3\reticulate\python\rpytools\call.py:7: UserWarning: Glyph 30446 (\N{CJK UNIFIED IDEOGRAPH-76EE}) missing from current font.
## value, error = rpycall.call_r_function(f, *args, **kwargs)
## C:\Users\takum\AppData\Local\R\win-library\4.3\reticulate\python\rpytools\call.py:7: UserWarning: Glyph 37329 (\N{CJK UNIFIED IDEOGRAPH-91D1}) missing from current font.
## value, error = rpycall.call_r_function(f, *args, **kwargs)
## C:\Users\takum\AppData\Local\R\win-library\4.3\reticulate\python\rpytools\call.py:7: UserWarning: Glyph 27969 (\N{CJK UNIFIED IDEOGRAPH-6D41}) missing from current font.
## value, error = rpycall.call_r_function(f, *args, **kwargs)
## C:\Users\takum\AppData\Local\R\win-library\4.3\reticulate\python\rpytools\call.py:7: UserWarning: Glyph 22303 (\N{CJK UNIFIED IDEOGRAPH-571F}) missing from current font.
## value, error = rpycall.call_r_function(f, *args, **kwargs)
## C:\Users\takum\AppData\Local\R\win-library\4.3\reticulate\python\rpytools\call.py:7: UserWarning: Glyph 20304 (\N{CJK UNIFIED IDEOGRAPH-4F50}) missing from current font.
## value, error = rpycall.call_r_function(f, *args, **kwargs)
