x <- c(5,40,25,10)

names(x) <- c('親子丼','カツ丼','天丼','牛丼')

x
## 親子丼 カツ丼   天丼   牛丼 
##      5     40     25     10
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 0x0000023CE6360FB0>, <matplotlib.patches.Wedge object at 0x0000023CE61DD880>, <matplotlib.patches.Wedge object at 0x0000023CE6361B80>, <matplotlib.patches.Wedge object at 0x0000023CE6362060>], [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()

library(plotrix)

x <- c(35, 15, 20, 25)
names(x) <- c('蘭鋳', '出目金', '流金', '土佐金')

plot_ly(type = 'pie', textinfo = 'label+percent', values = x, labels = names(x)) |>
  layout(title = 'ある金魚の売上げ数[匹]')