課題名 金魚の円グラフ
rm(list = ls()) # 全オブジェクト削除
# ここにRコードを記入する。
# 例)
plot(1:9)

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 0x00000215FFF28800>, <matplotlib.patches.Wedge object at 0x00000215FFF286B0>, <matplotlib.patches.Wedge object at 0x00000215FFF29190>, <matplotlib.patches.Wedge object at 0x00000215FFF297C0>], [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\shiro\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\shiro\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\shiro\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\shiro\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\shiro\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\shiro\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\shiro\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\shiro\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)
