changeset 3:ab1d3ad46a22

描画の場合分けを整理
author uncorrelated zombie <uncorrelated@yahoo.co.jp>
date Thu, 27 Oct 2022 17:06:50 +0900
parents 720ed4f3405a
children 9befa2fab20c
files EdgeworthBox.R app.R
diffstat 2 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/EdgeworthBox.R	Thu Oct 27 08:39:50 2022 +0900
+++ b/EdgeworthBox.R	Thu Oct 27 17:06:50 2022 +0900
@@ -1,4 +1,4 @@
-drawEdgeworthBox <- function(init_A=0.9, init_B=0.3, CC=TRUE, SHP=TRUE, IC_I=TRUE, IC_E=TRUE, CORE=TRUE){
+drawEdgeworthBox <- function(init_A=0.9, init_B=0.3, CC=TRUE, SHP=TRUE, IC_I=TRUE, IC_E=TRUE, CORE=TRUE, IP=TRUE){
     # 経済の財は合計1に固定し、かつそれぞれの配分の最小値を0.01とする
     modifyParam <- function(g){
         g <- max(0.01, g)
@@ -222,7 +222,7 @@
         pch <- 21 # 点の形状(21:丸, 22:四角, 23:菱形, 24:三角,25:逆三角, etc...)
 
         # 初期配分を描画
-        if(IC_I || SHP){
+        if(SHP || IP){
             points(initial_goods["person 1", "g/s A"], initial_goods["person 1", "g/s B"], pch=pch, col="blue", bg="blue")
             text(initial_goods["person 1", "g/s A"] + xadj, initial_goods["person 1", "g/s B"], expression(I), adj=c(0, 0))
         }
--- a/app.R	Thu Oct 27 08:39:50 2022 +0900
+++ b/app.R	Thu Oct 27 17:06:50 2022 +0900
@@ -19,6 +19,7 @@
                 min = 0.01,
                 max = 0.99,
                 value = 0.3),
+            checkboxInput("isIP", "Initial Point", TRUE),
             checkboxInput("isIC_I", "Indiffrent Curves pass through the Initial Point", TRUE),
             checkboxInput("isCore", "Core", TRUE),
             checkboxInput("isIC_E", "Indiffrent Curves pass through the Equilibrium", TRUE),
@@ -34,7 +35,9 @@
 
 server <- function(input, output) {
     output$distPlot <- renderPlot({
-        drawEdgeworthBox(input$A, input$B, CC=input$isCC, SHP=input$isSHP, IC_I=input$isIC_I, IC_E=input$isIC_E, CORE=input$isCore)
+        # inputにはwithが使えない
+        drawEdgeworthBox(input$A, input$B, CC=input$isCC, SHP=input$isSHP, IC_I=input$isIC_I,
+            IC_E=input$isIC_E, CORE=input$isCore, IP=input$isIP)
     }, width=400, height=400)
 }