Quelques tests de graphiques multi courbe

## Installing package into '/home/david/R/x86_64-pc-linux-gnu-library/3.4'
## (as 'lib' is unspecified)
## Installing package into '/home/david/R/x86_64-pc-linux-gnu-library/3.4'
## (as 'lib' is unspecified)
## Installing package into '/home/david/R/x86_64-pc-linux-gnu-library/3.4'
## (as 'lib' is unspecified)

Création des données fictives

yvalue0<- c
yvalue1<- c(100,120,115,90,125)
yvalue2<- c(100,140,145,150,180)
xtimestamp<- c(1538136000,1538136120,1538136240,1538136360,1538136480)

Transformation des timestamp en date

xdate<-anytime(xtimestamp)

Tracé des courbes

http://www.countbio.com/web_pages/left_object/R_for_biology/R_fundamentals/multiple_curves_R.html https://www.sixhat.net/plotting-multiple-data-series-in-r.html

plot(xdate,yvalue1,type="l",ylim=c(0.9*min(yvalue1,yvalue2),1.1*max(yvalue1,yvalue2)))
scale_color_gradient(low="blue", high="red")
## <ScaleContinuous>
##  Range:  
##  Limits:    0 --    1
points(xdate,yvalue2,type="l")

## Installing package into '/home/david/R/x86_64-pc-linux-gnu-library/3.4'
## (as 'lib' is unspecified)
plot(xdate,yvalue1,type="l",ylim=c(0.9*min(yvalue1,yvalue2),1.1*max(yvalue1,yvalue2)), col=wes_palette(name = "Royal1"))
points(xdate,yvalue2,type="l",col=wes_palette(name = "Royal1"))

NEWINTRADAYHIGH

## 'data.frame':    40 obs. of  7 variables:
##  $ ID                    : int  10033 10034 10035 10036 10037 10028 10029 10030 10031 10032 ...
##  $ LAST_UPDATE           : int  1537920000 1537920000 1537920000 1537920000 1537920000 1537833600 1537833600 1537833600 1537833600 1537833600 ...
##  $ MICRO_TRADER_USER_NAME: chr  "johntomoon" "johntomoon" "johntomoon" "johntomoon" ...
##  $ PORTFOLIO_NAME        : chr  "INTRADAY" "INTRADAY" "INTRADAY" "INTRADAY" ...
##  $ STRATEGY              : chr  "newIntradayHigh" "newIntradayHigh" "newIntradayHigh" "newIntradayHigh" ...
##  $ VALUE                 : chr  "17674.17322544707" "17674.17322544707" "17674.17322544707" "17674.17322544707" ...
##  $ BASE_CURRENCY         : chr  "EUR" "EUR" "EUR" "EUR" ...
## Installing package into '/home/david/R/x86_64-pc-linux-gnu-library/3.4'
## (as 'lib' is unspecified)
## Installing package into '/home/david/R/x86_64-pc-linux-gnu-library/3.4'
## (as 'lib' is unspecified)
summary(ptfh)
##        ID         LAST_UPDATE        MICRO_TRADER_USER_NAME
##  Min.   : 9998   Min.   :1.537e+09   Length:40             
##  1st Qu.:10008   1st Qu.:1.538e+09   Class :character      
##  Median :10018   Median :1.538e+09   Mode  :character      
##  Mean   :10018   Mean   :1.538e+09                         
##  3rd Qu.:10027   3rd Qu.:1.538e+09                         
##  Max.   :10037   Max.   :1.538e+09                         
##  PORTFOLIO_NAME       STRATEGY            VALUE          
##  Length:40          Length:40          Length:40         
##  Class :character   Class :character   Class :character  
##  Mode  :character   Mode  :character   Mode  :character  
##                                                          
##                                                          
##                                                          
##  BASE_CURRENCY     
##  Length:40         
##  Class :character  
##  Mode  :character  
##                    
##                    
## 
ptfh$value.num<-as.numeric(ptfh[,6])
ptfh$mtdate<-anytime(ptfh$LAST_UPDATE)
summary(ptfh$value.num)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   17674   18156   18514   18261   18514   18514
summary(ptfh$mtdate)
##                  Min.               1st Qu.                Median 
## "2018-09-21 02:00:00" "2018-09-22 20:00:00" "2018-09-23 14:00:00" 
##                  Mean               3rd Qu.                  Max. 
## "2018-09-23 14:00:00" "2018-09-24 08:00:00" "2018-09-26 02:00:00"
## Installing package into '/home/david/R/x86_64-pc-linux-gnu-library/3.4'
## (as 'lib' is unspecified)
ggplot(data = ptfh, aes(x=mtdate,y=VALUE, group = PORTFOLIO_NAME,col=as.factor(PORTFOLIO_NAME), lab))+geom_line()+scale_colour_discrete(name="Portefeuilles")

plot(ptfh$mtdate, ptfh$value.num, las=1)

plot(ptfh$mtdate, ptfh$value.num, type = "b", las=1)

plot(ptfh$mtdate, ptfh$value.num, xlab = "Temps", ylab = "Valeur du portfolio", type = "l", las=1)