基本の円グラフ
pie(x,labels = paste(names(x),round(x)),clockwise = T,main = 'ある金魚屋の売上げ数[匹]')

p <- x / sum(x) * 100
pie(p,labels = paste(names(p),round(p,1),'%'),clockwise = T,main = 'ある金魚屋の売上げ',col=c('orange',rgb(255,174,66,100,max=255),'lightblue','lightgreen'))

インタラクティブグラフ
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 = 'ある金魚屋の売上げ')
Python
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 0x0000028B5DD60A40>, <matplotlib.patches.Wedge object at 0x0000028B5DBD8740>, <matplotlib.patches.Wedge object at 0x0000028B5DD61670>, <matplotlib.patches.Wedge object at 0x0000028B5DD61AF0>], [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%')])
plt.show()
## C:\Users\81809\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\81809\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\81809\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\81809\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\81809\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\81809\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\81809\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\81809\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)
