課題名:デメキン
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([35, 15, 20, 25])
labels = ['蘭鋳', '出目金', '流金', '土佐金']
plt.pie(x, labels = labels,
startangle = 90,
counterclock = False,
autopct = '%1.1f%%')
## ([<matplotlib.patches.Wedge object at 0x000002DC1E5080B0>, <matplotlib.patches.Wedge object at 0x000002DC1E4A8740>, <matplotlib.patches.Wedge object at 0x000002DC1E555A60>, <matplotlib.patches.Wedge object at 0x000002DC1E5560F0>], [Text(1.0073506527883973, 0.4418649820101046, '蘭鋳'), Text(0.3571694673931416, -1.0403989482703737, '出目金'), Text(-0.8092962540148123, -0.7450097806321689, '流金'), Text(-0.8092963237676587, 0.7450097048603818, '土佐金')], [Text(0.5494639924300347, 0.2410172629146025, '36.8%'), Text(0.19481970948716812, -0.5674903354202038, '15.8%'), Text(-0.44143432037171576, -0.4063689712539103, '21.1%'), Text(-0.44143435841872286, 0.4063689299238446, '26.3%')])
