Showing posts with label Scatter plot. Show all posts
Showing posts with label Scatter plot. Show all posts

Wednesday, October 19, 2016

R (programming language): 3D Scatter Plot Example

Command:

> library(scatterplot3d)


Result:

 library(scatterplot3d) でエラー:
   ‘scatterplot3d’ という名前のパッケージはありません


Command:

> install.packages("scatterplot3d")


Result:

 パッケージを ‘/usr/local/lib/R/3.3/site-library’ 中にインストールします
 (‘lib’ が指定されていないため)
 --- このセッションで使うために、CRAN のミラーサイトを選んでください ---
HTTPS CRAN mirror

 1: 0-Cloud [https]                 2: Algeria [https]            
 3: Australia (Melbourne) [https]   4: Australia (Perth) [https]  
 5: Austria [https]                 6: Belgium (Ghent) [https]    
 7: Brazil (RJ) [https]             8: Brazil (SP 1) [https]      
 9: Bulgaria [https]               10: Canada (MB) [https]        
11: Chile [https]                  12: China (Beijing) [https]    
13: China (Hefei) [https]          14: Colombia (Cali) [https]    
15: Czech Republic [https]         16: Denmark [https]            
17: France (Lyon 1) [https]        18: France (Lyon 2) [https]    
19: France (Marseille) [https]     20: France (Montpellier) [https]
21: France (Paris 2) [https]       22: Germany (Falkenstein) [https]
23: Germany (Münster) [https]      24: Iceland [https]            
25: India [https]                  26: Ireland [https]            
27: Italy (Padua) [https]          28: Japan (Tokyo) [https]      
29: Malaysia [https]               30: Mexico (Mexico City) [https]
31: New Zealand [https]            32: Norway [https]              
33: Philippines [https]            34: Russia (Moscow) [https]    
35: Serbia [https]                 36: Spain (A Coruña) [https]    
37: Spain (Madrid) [https]         38: Switzerland [https]        
39: Taiwan (Chungli) [https]       40: Turkey (Denizli) [https]    
41: UK (Bristol) [https]           42: UK (Cambridge) [https]      
43: UK (London 1) [https]          44: USA (CA 1) [https]          
45: USA (IA) [https]               46: USA (KS) [https]            
47: USA (MI 1) [https]             48: USA (TN) [https]            
49: USA (TX) [https]               50: USA (WA) [https]            
51: (HTTP mirrors)                

Selection:


Entered value:

28


Result:

 URL 'https://cran.ism.ac.jp/src/contrib/scatterplot3d_0.3-37.tar.gz' を試しています
Content type 'application/x-gzip' length 585767 bytes (572 KB)
==================================================
downloaded 572 KB

 起動準備中です -  警告メッセージ:
1: Setting LC_TIME failed, using "C"
2: Setting LC_MESSAGES failed, using "C"
3: Setting LC_MONETARY failed, using "C"
* installing *source* package ‘scatterplot3d’ ...
**  パッケージ ‘scatterplot3d’ の解凍および MD5 サムの検証に成功しました
** R
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
 起動準備中です -  警告メッセージ:
1: Setting LC_TIME failed, using "C"
2: Setting LC_MESSAGES failed, using "C"
3: Setting LC_MONETARY failed, using "C"
* DONE (scatterplot3d)

 ダウンロードされたパッケージは、以下にあります
  ‘/private/var/folders/hh/0h10rfgn6vx07dqp8b7lv1700000gn/T/RtmpJRyDyQ/downloaded_packages’


Command:

> library(scatterplot3d)
> attach(mtcars)
> scatterplot3d(wt,disp,mpg,main="3D Scatterplot")


Result:

R 3D Scatter Plot

Command:

> wt


Result:

 [1] 2.620 2.875 2.320 3.215 3.440 3.460 3.570 3.190 3.150 3.440 3.440 4.070
[13] 3.730 3.780 5.250 5.424 5.345 2.200 1.615 1.835 2.465 3.520 3.435 3.840
[25] 3.845 1.935 2.140 1.513 3.170 2.770 3.570 2.780


Command:

> disp


Result:

 [1] 160.0 160.0 108.0 258.0 360.0 225.0 360.0 146.7 140.8 167.6 167.6 275.8
[13] 275.8 275.8 472.0 460.0 440.0  78.7  75.7  71.1 120.1 318.0 304.0 350.0
[25] 400.0  79.0 120.3  95.1 351.0 145.0 301.0 121.0


Command:

> mpg


Result:

 [1] 21.0 21.0 22.8 21.4 18.7 18.1 14.3 24.4 22.8 19.2 17.8 16.4 17.3 15.2 10.4
[16] 10.4 14.7 32.4 30.4 33.9 21.5 15.5 15.2 13.3 19.2 27.3 26.0 30.4 15.8 19.7
[31] 15.0 21.4

macOS Sierra: R (programming language): Scatter Plot Example

Command:

$ r


Result:

R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin16.0.0 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

During startup - Warning messages:
1: Setting LC_COLLATE failed, using "C"
2: Setting LC_TIME failed, using "C"
3: Setting LC_MESSAGES failed, using "C"
4: Setting LC_MONETARY failed, using "C"


Command:

> cars <-c(1,3,6,4,9)
> plot(cars)


Result:

R (programming language) Plot

Tuesday, October 18, 2016

MATLAB: Scatter Plot Example

Command:

Trial>> x = linspace(0,2*pi,25)


Result:

x =

  Columns 1 through 11

         0    0.2618    0.5236    0.7854    1.0472    1.3090    1.5708    1.8326    2.0944    2.3562    2.6180

  Columns 12 through 22

    2.8798    3.1416    3.4034    3.6652    3.9270    4.1888    4.4506    4.7124    4.9742    5.2360    5.4978

  Columns 23 through 25

    5.7596    6.0214    6.2832


Command:

Trial>> y = sin(x)


Result:

y =

  Columns 1 through 11

         0    0.2588    0.5000    0.7071    0.8660    0.9659    1.0000    0.9659    0.8660    0.7071    0.5000

  Columns 12 through 22

    0.2588    0.0000   -0.2588   -0.5000   -0.7071   -0.8660   -0.9659   -1.0000   -0.9659   -0.8660   -0.7071

  Columns 23 through 25

   -0.5000   -0.2588   -0.0000


Command:

Trial>> figure
Trial>> plot(x,y,'*')


Result: