x <- 1:100
n <- length(x)

set.seed(5)

d <- data.frame(
  u = rnorm(n, mean =  0, sd = 1),
  v = rnorm(n, mean =  2, sd = 2),
  w = rnorm(n, mean = -2, sd = 3)) 

COL <- c(rgb(255,   0,   0,  105, max = 255), 
         rgb(  0,   0, 255,  105, max = 255), 
         rgb(  0, 155,   0,  105, max = 255)) 
matplot(x, d, type = 'p', pch = colnames(d))

matplot(x, d, type = 'p', pch = 16, col = COL,
        main = '散布図',
        xlab = 'x軸ラベル[単位]',
        ylab = 'y軸ラベル[単位]')

grid()

legend('topleft', pch = 16, col = COL, legend = colnames(d))

matplot(x, d, type = 'n', 
        ylim = c(-10, 10),
        main = '散布図',
        xlab = 'x軸ラベル[単位]',
        ylab = 'y軸ラベル[単位]')

abline(lty = 2,               
       col = gray(0.5, 0.25), 
       h = seq(-10, 10, 5),   
       v = seq(0, 100, 20))   

PCH <- 16:18
matpoints(x, d$u, pch = PCH[1], col = COL[1])
matpoints(x, d$v, pch = PCH[2], col = COL[2])
matpoints(x, d$w, pch = PCH[3], col = COL[3])
 
legend('topright', pch = PCH, col = COL, legend = colnames(d))

pairs(d, pch = 16, col = COL[1])

library(plotly)
##  要求されたパッケージ ggplot2 をロード中です
## 
##  次のパッケージを付け加えます: 'plotly'
##  以下のオブジェクトは 'package:ggplot2' からマスクされています:
## 
##     last_plot
##  以下のオブジェクトは 'package:stats' からマスクされています:
## 
##     filter
##  以下のオブジェクトは 'package:graphics' からマスクされています:
## 
##     layout
kyokasho <- list(size = 11,
                 color = 'blue',
                 family = 'UD Digi Kyokasho NK-R')

plot_ly() %>%
  
  add_trace(x = x, y = d$u, name = 'u', marker = list(color = COL[1])) %>%
  add_trace(x = x, y = d$v, name = 'v', marker = list(color = COL[2])) %>%
  add_trace(x = x, y = d$w, name = 'w', marker = list(color = COL[3])) %>%
  
  layout(barmode = 'group',
         font  = kyokasho,
         title = '散布図',
         xaxis = list(title = 'x軸ラベル[単位]'),
         yaxis = list(title = 'y軸ラベル[単位]', range = c(-10, 10)))
## No trace type specified:
##   Based on info supplied, a 'scatter' trace seems appropriate.
##   Read more about this trace type -> https://plotly.com/r/reference/#scatter
## No scatter mode specifed:
##   Setting the mode to markers
##   Read more about this attribute -> https://plotly.com/r/reference/#scatter-mode
## No trace type specified:
##   Based on info supplied, a 'scatter' trace seems appropriate.
##   Read more about this trace type -> https://plotly.com/r/reference/#scatter
## No scatter mode specifed:
##   Setting the mode to markers
##   Read more about this attribute -> https://plotly.com/r/reference/#scatter-mode
## No trace type specified:
##   Based on info supplied, a 'scatter' trace seems appropriate.
##   Read more about this trace type -> https://plotly.com/r/reference/#scatter
## No scatter mode specifed:
##   Setting the mode to markers
##   Read more about this attribute -> https://plotly.com/r/reference/#scatter-mode

import numpy as np
import pandas as pd

np.random.seed(3)
u = np.random.normal(loc =-2.0, scale = 1.0, size = 100)
v = np.random.normal(loc = 0.0, scale = 2.0, size = 100)
w = np.random.normal(loc = 2.0, scale = 3.0, size = 100)

x = np.arange(1, 101, 1) 
import matplotlib.pyplot as plt

plt.title('散布図')
plt.xlabel('x軸ラベル[単位]')
plt.ylabel('y軸ラベル[単位]')

plt.grid(linestyle = '--', color = (0.9, 0.9, 0.9, 0.25))

plt.scatter(x, u, color = (1.0, 0.0, 1.0, 0.25), label = 'u', marker = 'o')
plt.scatter(x, v, color = (0.0, 1.0, 0.0, 0.25), label = 'v', marker = '^')
plt.scatter(x, w, color = (0.0, 0.0, 1.0, 0.25), label = 'w', marker = '*')

plt.legend(loc = 'upper left')

plt.show()
## C:\Users\naruk\AppData\Local\R\win-library\4.3\reticulate\python\rpytools\call.py:7: UserWarning: Glyph 36600 (\N{CJK UNIFIED IDEOGRAPH-8EF8}) missing from current font.
##   value, error = rpycall.call_r_function(f, *args, **kwargs)
## C:\Users\naruk\AppData\Local\R\win-library\4.3\reticulate\python\rpytools\call.py:7: UserWarning: Glyph 12521 (\N{KATAKANA LETTER RA}) missing from current font.
##   value, error = rpycall.call_r_function(f, *args, **kwargs)
## C:\Users\naruk\AppData\Local\R\win-library\4.3\reticulate\python\rpytools\call.py:7: UserWarning: Glyph 12505 (\N{KATAKANA LETTER BE}) missing from current font.
##   value, error = rpycall.call_r_function(f, *args, **kwargs)
## C:\Users\naruk\AppData\Local\R\win-library\4.3\reticulate\python\rpytools\call.py:7: UserWarning: Glyph 12523 (\N{KATAKANA LETTER RU}) missing from current font.
##   value, error = rpycall.call_r_function(f, *args, **kwargs)
## C:\Users\naruk\AppData\Local\R\win-library\4.3\reticulate\python\rpytools\call.py:7: UserWarning: Glyph 65339 (\N{FULLWIDTH LEFT SQUARE BRACKET}) missing from current font.
##   value, error = rpycall.call_r_function(f, *args, **kwargs)
## C:\Users\naruk\AppData\Local\R\win-library\4.3\reticulate\python\rpytools\call.py:7: UserWarning: Glyph 21336 (\N{CJK UNIFIED IDEOGRAPH-5358}) missing from current font.
##   value, error = rpycall.call_r_function(f, *args, **kwargs)
## C:\Users\naruk\AppData\Local\R\win-library\4.3\reticulate\python\rpytools\call.py:7: UserWarning: Glyph 20301 (\N{CJK UNIFIED IDEOGRAPH-4F4D}) missing from current font.
##   value, error = rpycall.call_r_function(f, *args, **kwargs)
## C:\Users\naruk\AppData\Local\R\win-library\4.3\reticulate\python\rpytools\call.py:7: UserWarning: Glyph 65341 (\N{FULLWIDTH RIGHT SQUARE BRACKET}) missing from current font.
##   value, error = rpycall.call_r_function(f, *args, **kwargs)
## C:\Users\naruk\AppData\Local\R\win-library\4.3\reticulate\python\rpytools\call.py:7: UserWarning: Glyph 25955 (\N{CJK UNIFIED IDEOGRAPH-6563}) missing from current font.
##   value, error = rpycall.call_r_function(f, *args, **kwargs)
## C:\Users\naruk\AppData\Local\R\win-library\4.3\reticulate\python\rpytools\call.py:7: UserWarning: Glyph 24067 (\N{CJK UNIFIED IDEOGRAPH-5E03}) missing from current font.
##   value, error = rpycall.call_r_function(f, *args, **kwargs)
## C:\Users\naruk\AppData\Local\R\win-library\4.3\reticulate\python\rpytools\call.py:7: UserWarning: Glyph 22259 (\N{CJK UNIFIED IDEOGRAPH-56F3}) missing from current font.
##   value, error = rpycall.call_r_function(f, *args, **kwargs)

x1 <- c(7, 4, 6, 2, 9, 3, 8, 1, 6, 3)
y1 <- c(3, 6, 5, 8, 3, 4, 2, 9, 2, 6)

x2 <- c(6, 3, 4, 9, 1, 8, 4, 2, 5, 7)
y2 <- c(7, 8, 2, 1, 7, 9, 6, 3, 5, 4)

matplot(x = x1,y = y1,type = "n")

matpoints(x = x1,y = y1, pch = PCH[1], col = COL[2])

matplot(x = x2,y = y2,type = "n")
matpoints(x = x2,y = y2, pch = PCH[1], col = COL[3])

summary(data.frame(x1, y1, x2, y2))
##        x1             y1            x2             y2      
##  Min.   :1.00   Min.   :2.0   Min.   :1.00   Min.   :1.00  
##  1st Qu.:3.00   1st Qu.:3.0   1st Qu.:3.25   1st Qu.:3.25  
##  Median :5.00   Median :4.5   Median :4.50   Median :5.50  
##  Mean   :4.90   Mean   :4.8   Mean   :4.90   Mean   :5.20  
##  3rd Qu.:6.75   3rd Qu.:6.0   3rd Qu.:6.75   3rd Qu.:7.00  
##  Max.   :9.00   Max.   :9.0   Max.   :9.00   Max.   :9.00