[Returnanalytics-commits] r2842 - in pkg/PortfolioAnalytics: R man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Aug 21 02:46:37 CEST 2013


Author: rossbennett34
Date: 2013-08-21 02:46:37 +0200 (Wed, 21 Aug 2013)
New Revision: 2842

Modified:
   pkg/PortfolioAnalytics/R/chart.RiskReward.R
   pkg/PortfolioAnalytics/R/charts.DE.R
   pkg/PortfolioAnalytics/R/charts.GenSA.R
   pkg/PortfolioAnalytics/R/charts.PSO.R
   pkg/PortfolioAnalytics/R/charts.ROI.R
   pkg/PortfolioAnalytics/R/charts.RP.R
   pkg/PortfolioAnalytics/man/chart.RiskReward.Rd
   pkg/PortfolioAnalytics/man/charts.DE.Rd
   pkg/PortfolioAnalytics/man/charts.GenSA.Rd
   pkg/PortfolioAnalytics/man/charts.ROI.Rd
   pkg/PortfolioAnalytics/man/charts.RP.Rd
   pkg/PortfolioAnalytics/man/charts.pso.Rd
   pkg/PortfolioAnalytics/man/plot.optimize.portfolio.DEoptim.Rd
   pkg/PortfolioAnalytics/man/plot.optimize.portfolio.GenSA.Rd
   pkg/PortfolioAnalytics/man/plot.optimize.portfolio.ROI.Rd
   pkg/PortfolioAnalytics/man/plot.optimize.portfolio.Rd
   pkg/PortfolioAnalytics/man/plot.optimize.portfolio.pso.Rd
   pkg/PortfolioAnalytics/man/plot.optimize.portfolio.random.Rd
Log:
adding xlim and ylim arguments to chart.Scatter.* for better control of plotting

Modified: pkg/PortfolioAnalytics/R/chart.RiskReward.R
===================================================================
--- pkg/PortfolioAnalytics/R/chart.RiskReward.R	2013-08-20 21:08:55 UTC (rev 2841)
+++ pkg/PortfolioAnalytics/R/chart.RiskReward.R	2013-08-21 00:46:37 UTC (rev 2842)
@@ -11,9 +11,11 @@
 #' @param chart.assets TRUE/FALSE. Includes a risk reward scatter of the assets in the chart
 #' @param cex.axis The magnification to be used for axis annotation relative to the current setting of \code{cex}
 #' @param element.color color for the default plot scatter points
+#' @param xlim set the x-axis limit, same as in \code{\link{plot}}
+#' @param ylim set the y-axis limit, same as in \code{\link{plot}}
 #' @seealso \code{\link{optimize.portfolio}}
 #' @export
-chart.RiskReward <- function(object, neighbors, ..., rp=FALSE, return.col="mean", risk.col="ES", element.color = "darkgray", cex.axis=0.8){
+chart.RiskReward <- function(object, neighbors, ..., rp=FALSE, return.col="mean", risk.col="ES", element.color = "darkgray", cex.axis=0.8, ylim=NULL, xlim=NULL){
   UseMethod("chart.RiskReward")
 }
 

Modified: pkg/PortfolioAnalytics/R/charts.DE.R
===================================================================
--- pkg/PortfolioAnalytics/R/charts.DE.R	2013-08-20 21:08:55 UTC (rev 2841)
+++ pkg/PortfolioAnalytics/R/charts.DE.R	2013-08-21 00:46:37 UTC (rev 2842)
@@ -77,7 +77,7 @@
 
 #' @rdname chart.RiskReward
 #' @export
-chart.Scatter.DE <- function(object, neighbors = NULL, ..., return.col='mean', risk.col='ES', chart.assets=FALSE, element.color = "darkgray", cex.axis=0.8){
+chart.Scatter.DE <- function(object, neighbors = NULL, ..., return.col='mean', risk.col='ES', chart.assets=FALSE, element.color = "darkgray", cex.axis=0.8, xlim=NULL, ylim=NULL){
   # more or less specific to the output of the DEoptim portfolio code with constraints
   # will work to a point with other functions, such as optimize.porfolio.parallel
   # there's still a lot to do to improve this.
@@ -143,13 +143,15 @@
     asset_ret <- scatterFUN(R=R, FUN=return.col, ...=...)
     asset_risk <- scatterFUN(R=R, FUN=risk.col, ...=...)
     rnames <- colnames(R)
+    xlim <- range(c(xtract[,risk.column], asset_risk))
+    ylim <- range(c(xtract[,return.column], asset_ret))
   } else {
     asset_ret <- NULL
     asset_risk <- NULL
   }
   
   # plot the portfolios from DEoptim_objective_results
-  plot(xtract[,risk.column],xtract[,return.column], xlab=risk.col, ylab=return.col, col="darkgray", axes=FALSE, ...)
+  plot(xtract[,risk.column],xtract[,return.column], xlab=risk.col, ylab=return.col, col="darkgray", axes=FALSE, xlim=xlim, ylim=ylim, ...)
   
   # plot the risk-reward scatter of the assets
   if(chart.assets){
@@ -297,13 +299,13 @@
 #' \code{\link{optimize.portfolio}}
 #' \code{\link{extractStats}}
 #' @export
-charts.DE <- function(DE, risk.col, return.col, chart.assets, neighbors=NULL, main="DEoptim.Portfolios", ...){
+charts.DE <- function(DE, risk.col, return.col, chart.assets, neighbors=NULL, main="DEoptim.Portfolios", xlim=NULL, ylim=NULL, ...){
 # Specific to the output of the random portfolio code with constraints
     # @TODO: check that DE is of the correct class
     op <- par(no.readonly=TRUE)
     layout(matrix(c(1,2)),height=c(2,1.5),width=1)
     par(mar=c(4,4,4,2))
-    chart.Scatter.DE(object=DE, risk.col=risk.col, return.col=return.col, chart.assets=chart.assets, neighbors=neighbors, main=main, ...)
+    chart.Scatter.DE(object=DE, risk.col=risk.col, return.col=return.col, chart.assets=chart.assets, neighbors=neighbors, main=main, xlim=xlim, ylim=ylim, ...)
     par(mar=c(2,4,0,2))
     chart.Weights.DE(object=DE, main="", neighbors=neighbors, ...)
     par(op)
@@ -330,6 +332,6 @@
 #' @param neighbors set of 'neighbor portfolios to overplot
 #' @param main an overall title for the plot: see \code{\link{title}}
 #' @export
-plot.optimize.portfolio.DEoptim <- function(x, ..., return.col='mean', risk.col='ES',  chart.assets=FALSE, neighbors=NULL, main='optimized portfolio plot') {
-    charts.DE(DE=x, risk.col=risk.col, return.col=return.col, chart.assets=chart.assets, neighbors=neighbors, main=main, ...)
+plot.optimize.portfolio.DEoptim <- function(x, ..., return.col='mean', risk.col='ES',  chart.assets=FALSE, neighbors=NULL, xlim=NULL, ylim=NULL, main='optimized portfolio plot') {
+    charts.DE(DE=x, risk.col=risk.col, return.col=return.col, chart.assets=chart.assets, neighbors=neighbors, main=main, xlim=xlim, ylim=ylim, ...)
 }

Modified: pkg/PortfolioAnalytics/R/charts.GenSA.R
===================================================================
--- pkg/PortfolioAnalytics/R/charts.GenSA.R	2013-08-20 21:08:55 UTC (rev 2841)
+++ pkg/PortfolioAnalytics/R/charts.GenSA.R	2013-08-21 00:46:37 UTC (rev 2842)
@@ -65,7 +65,7 @@
 
 #' @rdname chart.RiskReward
 #' @export
-chart.Scatter.GenSA <- function(object, neighbors=NULL, ..., rp=FALSE, return.col="mean", risk.col="ES", chart.assets=FALSE, element.color="darkgray", cex.axis=0.8){
+chart.Scatter.GenSA <- function(object, neighbors=NULL, ..., rp=FALSE, return.col="mean", risk.col="ES", chart.assets=FALSE, element.color="darkgray", cex.axis=0.8, ylim=NULL, xlim=NULL){
   
   if(!inherits(object, "optimize.portfolio.GenSA")) stop("object must be of class 'optimize.portfolio.GenSA'")
   
@@ -99,8 +99,12 @@
   }
   
   # get limits for x and y axis
-  ylim <- range(returnpoints, asset_ret)
-  xlim <- range(riskpoints, asset_risk)
+  if(is.null(ylim)){
+    ylim <- range(returnpoints, asset_ret)
+  }
+  if(is.null(xlim)){
+    xlim <- range(riskpoints, asset_risk)
+  }
   
   # Plot the portfolios
   plot(x=riskpoints, y=returnpoints, xlab=risk.col, ylab=return.col, col="darkgray", ylim=ylim, xlim=xlim, axes=FALSE, ...)
@@ -139,12 +143,12 @@
 #' @seealso \code{\link{optimize.portfolio}}
 #' @author Ross Bennett
 #' @export
-charts.GenSA <- function(GenSA, rp=FALSE, return.col="mean", risk.col="ES", chart.assets=FALSE, cex.axis=0.8, element.color="darkgray", neighbors=NULL, main="GenSA.Portfolios", ...){
+charts.GenSA <- function(GenSA, rp=FALSE, return.col="mean", risk.col="ES", chart.assets=FALSE, cex.axis=0.8, element.color="darkgray", neighbors=NULL, main="GenSA.Portfolios", xlim=NULL, ylim=NULL, ...){
   # Specific to the output of the optimize_method=GenSA
   op <- par(no.readonly=TRUE)
   layout(matrix(c(1,2)),height=c(2,2),width=1)
   par(mar=c(4,4,4,2))
-  chart.Scatter.GenSA(object=GenSA, rp=rp, return.col=return.col, risk.col=risk.col, chart.assets=chart.assets, element.color=element.color, cex.axis=cex.axis, main=main, ...=...)
+  chart.Scatter.GenSA(object=GenSA, rp=rp, return.col=return.col, risk.col=risk.col, chart.assets=chart.assets, element.color=element.color, cex.axis=cex.axis, main=main, xlim=xlim, ylim=ylim, ...=...)
   par(mar=c(2,4,0,2))
   chart.Weights.GenSA(object=GenSA, neighbors=neighbors, las=3, xlab=NULL, cex.lab=1, element.color=element.color, cex.axis=cex.axis, ...=..., main="")
   par(op)
@@ -167,6 +171,6 @@
 #' @seealso \code{\link{optimize.portfolio}}
 #' @author Ross Bennett
 #' @export
-plot.optimize.portfolio.GenSA <- function(GenSA, rp=FALSE, return.col="mean", risk.col="ES", chart.assets=FALSE, cex.axis=0.8, element.color="darkgray", neighbors=NULL, main="GenSA.Portfolios", ...){
-  charts.GenSA(GenSA=GenSA, rp=rp, return.col=return.col, risk.col=risk.col, chart.assets=chart.assets, cex.axis=cex.axis, element.color=element.color, neighbors=neighbors, main=main, ...=...)
+plot.optimize.portfolio.GenSA <- function(GenSA, rp=FALSE, return.col="mean", risk.col="ES", chart.assets=FALSE, cex.axis=0.8, element.color="darkgray", neighbors=NULL, main="GenSA.Portfolios", xlim=NULL, ylim=NULL, ...){
+  charts.GenSA(GenSA=GenSA, rp=rp, return.col=return.col, risk.col=risk.col, chart.assets=chart.assets, cex.axis=cex.axis, element.color=element.color, neighbors=neighbors, main=main, xlim=xlim, ylim=ylim, ...=...)
 }

Modified: pkg/PortfolioAnalytics/R/charts.PSO.R
===================================================================
--- pkg/PortfolioAnalytics/R/charts.PSO.R	2013-08-20 21:08:55 UTC (rev 2841)
+++ pkg/PortfolioAnalytics/R/charts.PSO.R	2013-08-21 00:46:37 UTC (rev 2842)
@@ -65,7 +65,7 @@
 
 #' @rdname chart.RiskReward
 #' @export
-chart.Scatter.pso <- function(object, neighbors=NULL, ..., return.col="mean", risk.col="ES", chart.assets=FALSE, element.color = "darkgray", cex.axis=0.8){
+chart.Scatter.pso <- function(object, neighbors=NULL, ..., return.col="mean", risk.col="ES", chart.assets=FALSE, element.color = "darkgray", cex.axis=0.8, xlim=NULL, ylim=NULL){
   if(!inherits(object, "optimize.portfolio.pso")) stop("object must be of class 'optimize.portfolio.pso'")
   R <- object$R
   # Object with the "out" value in the first column and the normalized weights
@@ -89,8 +89,12 @@
   }
   
   # get limits for x and y axis
-  ylim <- range(returnpoints, asset_ret)
-  xlim <- range(riskpoints, asset_risk)
+  if(is.null(ylim)){
+    ylim <- range(returnpoints, asset_ret)
+  }
+  if(is.null(xlim)){
+    xlim <- range(riskpoints, asset_risk)
+  }
   
   # plot the portfolios
   plot(x=riskpoints, y=returnpoints, xlab=risk.col, ylab=return.col, xlim=xlim, ylim=ylim, col="darkgray", axes=FALSE, ...)
@@ -128,12 +132,12 @@
 #' @seealso \code{\link{optimize.portfolio}}
 #' @author Ross Bennett
 #' @export
-charts.pso <- function(pso, return.col="mean", risk.col="ES", chart.assets=FALSE, cex.axis=0.8, element.color="darkgray", neighbors=NULL, main="PSO.Portfolios", ...){
+charts.pso <- function(pso, return.col="mean", risk.col="ES", chart.assets=FALSE, cex.axis=0.8, element.color="darkgray", neighbors=NULL, main="PSO.Portfolios", xlim=NULL, ylim=NULL, ...){
   # Specific to the output of the optimize_method=pso
   op <- par(no.readonly=TRUE)
   layout(matrix(c(1,2)),height=c(2,2),width=1)
   par(mar=c(4,4,4,2))
-  chart.Scatter.pso(object=pso, return.col=return.col, risk.col=risk.col, chart.assets=chart.assets, element.color=element.color, cex.axis=cex.axis, main=main, ...=...)
+  chart.Scatter.pso(object=pso, return.col=return.col, risk.col=risk.col, chart.assets=chart.assets, element.color=element.color, cex.axis=cex.axis, main=main, xlim=xlim, ylim=ylim, ...=...)
   par(mar=c(2,4,0,2))
   chart.Weights.pso(object=pso, neighbors=neighbors, las=3, xlab=NULL, cex.lab=1, element.color=element.color, cex.axis=cex.axis, ...=..., main="")
   par(op)
@@ -155,6 +159,6 @@
 #' @seealso \code{\link{optimize.portfolio}}
 #' @author Ross Bennett
 #' @export
-plot.optimize.portfolio.pso <- function(pso, return.col="mean", risk.col="ES", chart.assets=FALSE, cex.axis=0.8, element.color="darkgray", neighbors=NULL, main="PSO.Portfolios", ...){
-  charts.pso(pso=pso, return.col=return.col, risk.col=risk.col, chart.assets=FALSE, cex.axis=cex.axis, element.color=element.color, neighbors=neighbors, main=main, ...=...)
+plot.optimize.portfolio.pso <- function(pso, return.col="mean", risk.col="ES", chart.assets=FALSE, cex.axis=0.8, element.color="darkgray", neighbors=NULL, main="PSO.Portfolios", xlim=NULL, ylim=NULL, ...){
+  charts.pso(pso=pso, return.col=return.col, risk.col=risk.col, chart.assets=FALSE, cex.axis=cex.axis, element.color=element.color, neighbors=neighbors, main=main, xlim=xlim, ylim=ylim, ...=...)
 }

Modified: pkg/PortfolioAnalytics/R/charts.ROI.R
===================================================================
--- pkg/PortfolioAnalytics/R/charts.ROI.R	2013-08-20 21:08:55 UTC (rev 2841)
+++ pkg/PortfolioAnalytics/R/charts.ROI.R	2013-08-21 00:46:37 UTC (rev 2842)
@@ -65,7 +65,7 @@
 
 #' @rdname chart.RiskReward
 #' @export
-chart.Scatter.ROI <- function(object, neighbors=NULL, ..., rp=FALSE, return.col="mean", risk.col="ES", chart.assets=FALSE, element.color = "darkgray", cex.axis=0.8){
+chart.Scatter.ROI <- function(object, neighbors=NULL, ..., rp=FALSE, return.col="mean", risk.col="ES", chart.assets=FALSE, element.color = "darkgray", cex.axis=0.8, xlim=NULL, ylim=NULL){
   
   if(!inherits(object, "optimize.portfolio.ROI")) stop("object must be of class 'optimize.portfolio.ROI'")
   
@@ -99,11 +99,15 @@
   }
   
   # get limits for x and y axis
-  ylim <- range(returnpoints, asset_ret)
-  xlim <- range(riskpoints, asset_risk)
+  if(is.null(ylim)){
+    ylim <- range(c(returnpoints, asset_ret))
+  }
+  if(is.null(xlim)){
+    xlim <- range(c(riskpoints, asset_risk))
+  }
   
   # Plot the portfolios
-  plot(x=riskpoints, y=returnpoints, xlab=risk.col, ylab=return.col, col="darkgray", ylim=ylim, xlim=xlim, axes=FALSE, ...)
+  plot(x=riskpoints, y=returnpoints, xlab=risk.col, ylab=return.col, col="darkgray", xlim=xlim, ylim=ylim, axes=FALSE, ...)
   # Plot the optimal portfolio
   points(x=riskpoints[1], y=returnpoints[1], col="blue", pch=16) # optimal
   text(x=riskpoints[1], y=returnpoints[1], labels="Optimal",col="blue", pos=4, cex=0.8)
@@ -143,15 +147,14 @@
 #' @seealso \code{\link{optimize.portfolio}}
 #' @author Ross Bennett
 #' @export
-charts.ROI <- function(ROI, rp=FALSE, risk.col="StdDev", return.col="mean", chart.assets=FALSE, cex.axis=0.8, element.color="darkgray", neighbors=NULL, main="ROI.Portfolios", ...){
+charts.ROI <- function(ROI, rp=FALSE, risk.col="ES", return.col="mean", chart.assets=FALSE, cex.axis=0.8, element.color="darkgray", neighbors=NULL, main="ROI.Portfolios", xlim=NULL, ylim=NULL, ...){
   # Specific to the output of the optimize_method=ROI
-  R <- ROI$R
   op <- par(no.readonly=TRUE)
   layout(matrix(c(1,2)),height=c(2,1.5),width=1)
   par(mar=c(4,4,4,2))
-  chart.Scatter.ROI(ROI, rp=rp, return.col=return.col, risk.col=risk.col, chart.assets=chart.assets, ..., element.color=element.color, cex.axis=cex.axis, main=main)
+  chart.Scatter.ROI(object=ROI, rp=rp, return.col=return.col, risk.col=risk.col, ..., chart.assets=chart.assets, element.color=element.color, cex.axis=cex.axis, main=main, xlim=xlim, ylim=ylim)
   par(mar=c(2,4,0,2))
-  chart.Weights.ROI(ROI, neighbors=neighbors, ..., main="", las=3, xlab=NULL, cex.lab=1, element.color=element.color, cex.axis=cex.axis)
+  chart.Weights.ROI(object=ROI, neighbors=neighbors, ..., main="", las=3, xlab=NULL, cex.lab=1, element.color=element.color, cex.axis=cex.axis)
   par(op)
 }
 
@@ -175,6 +178,6 @@
 #' @seealso \code{\link{optimize.portfolio}}
 #' @author Ross Bennett
 #' @export
-plot.optimize.portfolio.ROI <- function(ROI, rp=FALSE, risk.col="ES", return.col="mean", chart.assets=chart.assets, element.color="darkgray", neighbors=NULL, main="ROI.Portfolios", ...){
-  charts.ROI(ROI=ROI, rp=rp, risk.col=risk.col, return.col=return.col, chart.assets=chart.assets, main=main, ...)
+plot.optimize.portfolio.ROI <- function(ROI, rp=FALSE, risk.col="ES", return.col="mean", chart.assets=chart.assets, element.color="darkgray", neighbors=NULL, main="ROI.Portfolios", xlim=NULL, ylim=NULL, ...){
+  charts.ROI(ROI=ROI, rp=rp, risk.col=risk.col, return.col=return.col, chart.assets=chart.assets, main=main, xlim=xlim, ylim=ylim, ...)
 }

Modified: pkg/PortfolioAnalytics/R/charts.RP.R
===================================================================
--- pkg/PortfolioAnalytics/R/charts.RP.R	2013-08-20 21:08:55 UTC (rev 2841)
+++ pkg/PortfolioAnalytics/R/charts.RP.R	2013-08-21 00:46:37 UTC (rev 2842)
@@ -81,7 +81,7 @@
 
 #' @rdname chart.RiskReward
 #' @export
-chart.Scatter.RP <- function(object, neighbors = NULL, ..., return.col='mean', risk.col='ES', chart.assets=FALSE, element.color = "darkgray", cex.axis=0.8){
+chart.Scatter.RP <- function(object, neighbors = NULL, ..., return.col='mean', risk.col='ES', chart.assets=FALSE, element.color = "darkgray", cex.axis=0.8, xlim=NULL, ylim=NULL){
   # more or less specific to the output of the random portfolio code with constraints
   # will work to a point with other functions, such as optimize.porfolio.parallel
   # there's still a lot to do to improve this.
@@ -146,13 +146,15 @@
     asset_ret <- scatterFUN(R=R, FUN=return.col, ...=...)
     asset_risk <- scatterFUN(R=R, FUN=risk.col, ...=...)
     rnames <- colnames(R)
+    xlim <- range(c(xtract[,risk.column], asset_risk))
+    ylim <- range(c(xtract[,return.column], asset_ret))
   } else {
     asset_ret <- NULL
     asset_risk <- NULL
   }
   
   # plot the random portfolios
-  plot(xtract[,risk.column],xtract[,return.column], xlab=risk.col, ylab=return.col, col="darkgray", axes=FALSE, ...)
+  plot(xtract[,risk.column],xtract[,return.column], xlab=risk.col, ylab=return.col, col="darkgray", axes=FALSE, xlim=xlim, ylim=ylim, ...)
   
   # plot the risk-reward scatter of the assets
   if(chart.assets){
@@ -257,13 +259,13 @@
 #' \code{\link{optimize.portfolio}}
 #' \code{\link{extractStats}}
 #' @export
-charts.RP <- function(RP, risk.col, return.col, chart.assets=FALSE, neighbors=NULL, main="Random.Portfolios", ...){
+charts.RP <- function(RP, risk.col, return.col, chart.assets=FALSE, neighbors=NULL, main="Random.Portfolios", xlim=NULL, ylim=NULL, ...){
   # Specific to the output of the random portfolio code with constraints
   # @TODO: check that RP is of the correct class
   op <- par(no.readonly=TRUE)
   layout(matrix(c(1,2)),height=c(2,1.5),width=1)
   par(mar=c(4,4,4,2))
-  chart.Scatter.RP(object=RP, risk.col=risk.col, return.col=return.col, chart.assets=chart.assets, neighbors=neighbors, main=main, ...)
+  chart.Scatter.RP(object=RP, risk.col=risk.col, return.col=return.col, chart.assets=chart.assets, neighbors=neighbors, main=main, xlim=NULL, ylim=NULL, ...)
   par(mar=c(2,4,0,2))
   chart.Weights.RP(object=RP, main="", neighbors=neighbors, ...)
   par(op)
@@ -290,8 +292,8 @@
 #' @param neighbors set of 'neighbor portfolios to overplot
 #' @param main an overall title for the plot: see \code{\link{title}}
 #' @export
-plot.optimize.portfolio.random <- function(x, ...,  R=NULL, return.col='mean', risk.col='ES',  chart.assets=FALSE, neighbors=NULL, main='optimized portfolio plot') {
-    charts.RP(RP=x, risk.col=risk.col, return.col=return.col, chart.assets=chart.assets, neighbors=neighbors, main=main, ...)
+plot.optimize.portfolio.random <- function(x, ...,  R=NULL, return.col='mean', risk.col='ES',  chart.assets=FALSE, neighbors=NULL, xlim=NULL, ylim=NULL, main='optimized portfolio plot') {
+    charts.RP(RP=x, risk.col=risk.col, return.col=return.col, chart.assets=chart.assets, neighbors=neighbors, main=main, xlim=xlim, ylim=ylim, ...)
 }
 
 #' plot method for optimize.portfolio output
@@ -315,6 +317,6 @@
 #' @param neighbors set of 'neighbor portfolios to overplot
 #' @param main an overall title for the plot: see \code{\link{title}}
 #' @export
-plot.optimize.portfolio <- function(x, ...,  return.col='mean', risk.col='ES',  chart.assets=FALSE, neighbors=NULL, main='optimized portfolio plot') {
-    charts.RP(RP=x, risk.col=risk.col, return.col=return.col, chart.assets=chart.assets, neighbors=neighbors, main=main, ...)
+plot.optimize.portfolio <- function(x, ...,  return.col='mean', risk.col='ES',  chart.assets=FALSE, neighbors=NULL, xlim=NULL, ylim=NULL, main='optimized portfolio plot') {
+    charts.RP(RP=x, risk.col=risk.col, return.col=return.col, chart.assets=chart.assets, neighbors=neighbors, main=main, xlim=xlim, ylim=ylim, ...)
 }
\ No newline at end of file

Modified: pkg/PortfolioAnalytics/man/chart.RiskReward.Rd
===================================================================
--- pkg/PortfolioAnalytics/man/chart.RiskReward.Rd	2013-08-20 21:08:55 UTC (rev 2841)
+++ pkg/PortfolioAnalytics/man/chart.RiskReward.Rd	2013-08-21 00:46:37 UTC (rev 2842)
@@ -15,56 +15,62 @@
   chart.Scatter.DE(object, neighbors = NULL, ...,
     return.col = "mean", risk.col = "ES",
     chart.assets = FALSE, element.color = "darkgray",
-    cex.axis = 0.8)
+    cex.axis = 0.8, xlim = NULL, ylim = NULL)
 
   chart.RiskReward.optimize.portfolio.DEoptim(object,
     neighbors = NULL, ..., return.col = "mean",
     risk.col = "ES", chart.assets = FALSE,
-    element.color = "darkgray", cex.axis = 0.8)
+    element.color = "darkgray", cex.axis = 0.8,
+    xlim = NULL, ylim = NULL)
 
   chart.Scatter.RP(object, neighbors = NULL, ...,
     return.col = "mean", risk.col = "ES",
     chart.assets = FALSE, element.color = "darkgray",
-    cex.axis = 0.8)
+    cex.axis = 0.8, xlim = NULL, ylim = NULL)
 
   chart.RiskReward.optimize.portfolio.random(object,
     neighbors = NULL, ..., return.col = "mean",
     risk.col = "ES", chart.assets = FALSE,
-    element.color = "darkgray", cex.axis = 0.8)
+    element.color = "darkgray", cex.axis = 0.8,
+    xlim = NULL, ylim = NULL)
 
   chart.Scatter.ROI(object, neighbors = NULL, ...,
     rp = FALSE, return.col = "mean", risk.col = "ES",
     chart.assets = FALSE, element.color = "darkgray",
-    cex.axis = 0.8)
+    cex.axis = 0.8, xlim = NULL, ylim = NULL)
 
   chart.RiskReward.optimize.portfolio.ROI(object,
     neighbors = NULL, ..., rp = FALSE, return.col = "mean",
     risk.col = "ES", chart.assets = FALSE,
-    element.color = "darkgray", cex.axis = 0.8)
+    element.color = "darkgray", cex.axis = 0.8,
+    xlim = NULL, ylim = NULL)
 
   chart.Scatter.pso(object, neighbors = NULL, ...,
     return.col = "mean", risk.col = "ES",
     chart.assets = FALSE, element.color = "darkgray",
-    cex.axis = 0.8)
+    cex.axis = 0.8, xlim = NULL, ylim = NULL)
 
   chart.RiskReward.optimize.portfolio.pso(object,
     neighbors = NULL, ..., return.col = "mean",
     risk.col = "ES", chart.assets = FALSE,
-    element.color = "darkgray", cex.axis = 0.8)
+    element.color = "darkgray", cex.axis = 0.8,
+    xlim = NULL, ylim = NULL)
 
   chart.Scatter.GenSA(object, neighbors = NULL, ...,
     rp = FALSE, return.col = "mean", risk.col = "ES",
     chart.assets = FALSE, element.color = "darkgray",
-    cex.axis = 0.8)
+    cex.axis = 0.8, ylim = NULL, xlim = NULL)
 
   chart.RiskReward.optimize.portfolio.GenSA(object,
     neighbors = NULL, ..., rp = FALSE, return.col = "mean",
     risk.col = "ES", chart.assets = FALSE,
-    element.color = "darkgray", cex.axis = 0.8)
+    element.color = "darkgray", cex.axis = 0.8,
+    ylim = NULL, xlim = NULL)
 
   chart.RiskReward(object, neighbors, ..., rp = FALSE,
     return.col = "mean", risk.col = "ES",
-    element.color = "darkgray", cex.axis = 0.8)
+    element.color = "darkgray", cex.axis = 0.8,
+    ylim = NULL, xlim = NULL)
 }
 \arguments{
   \item{object}{optimal portfolio created by
@@ -93,6 +99,12 @@
 
   \item{element.color}{color for the default plot scatter
   points}
+
+  \item{xlim}{set the x-axis limit, same as in
+  \code{\link{plot}}}
+
+  \item{ylim}{set the y-axis limit, same as in
+  \code{\link{plot}}}
 }
 \description{
   classic risk reward scatter

Modified: pkg/PortfolioAnalytics/man/charts.DE.Rd
===================================================================
--- pkg/PortfolioAnalytics/man/charts.DE.Rd	2013-08-20 21:08:55 UTC (rev 2841)
+++ pkg/PortfolioAnalytics/man/charts.DE.Rd	2013-08-21 00:46:37 UTC (rev 2842)
@@ -3,7 +3,8 @@
 \title{scatter and weights chart  for random portfolios}
 \usage{
   charts.DE(DE, risk.col, return.col, chart.assets,
-    neighbors = NULL, main = "DEoptim.Portfolios", ...)
+    neighbors = NULL, main = "DEoptim.Portfolios",
+    xlim = NULL, ylim = NULL, ...)
 }
 \arguments{
   \item{DE}{set of random portfolios created by

Modified: pkg/PortfolioAnalytics/man/charts.GenSA.Rd
===================================================================
--- pkg/PortfolioAnalytics/man/charts.GenSA.Rd	2013-08-20 21:08:55 UTC (rev 2841)
+++ pkg/PortfolioAnalytics/man/charts.GenSA.Rd	2013-08-21 00:46:37 UTC (rev 2842)
@@ -5,7 +5,8 @@
   charts.GenSA(GenSA, rp = FALSE, return.col = "mean",
     risk.col = "ES", chart.assets = FALSE, cex.axis = 0.8,
     element.color = "darkgray", neighbors = NULL,
-    main = "GenSA.Portfolios", ...)
+    main = "GenSA.Portfolios", xlim = NULL, ylim = NULL,
+    ...)
 }
 \arguments{
   \item{GenSA}{object created by

Modified: pkg/PortfolioAnalytics/man/charts.ROI.Rd
===================================================================
--- pkg/PortfolioAnalytics/man/charts.ROI.Rd	2013-08-20 21:08:55 UTC (rev 2841)
+++ pkg/PortfolioAnalytics/man/charts.ROI.Rd	2013-08-21 00:46:37 UTC (rev 2842)
@@ -2,10 +2,11 @@
 \alias{charts.ROI}
 \title{scatter and weights chart for portfolios}
 \usage{
-  charts.ROI(ROI, rp = FALSE, risk.col = "StdDev",
+  charts.ROI(ROI, rp = FALSE, risk.col = "ES",
     return.col = "mean", chart.assets = FALSE,
     cex.axis = 0.8, element.color = "darkgray",
-    neighbors = NULL, main = "ROI.Portfolios", ...)
+    neighbors = NULL, main = "ROI.Portfolios", xlim = NULL,
+    ylim = NULL, ...)
 }
 \arguments{
   \item{ROI}{object created by

Modified: pkg/PortfolioAnalytics/man/charts.RP.Rd
===================================================================
--- pkg/PortfolioAnalytics/man/charts.RP.Rd	2013-08-20 21:08:55 UTC (rev 2841)
+++ pkg/PortfolioAnalytics/man/charts.RP.Rd	2013-08-21 00:46:37 UTC (rev 2842)
@@ -3,7 +3,8 @@
 \title{scatter and weights chart  for random portfolios}
 \usage{
   charts.RP(RP, risk.col, return.col, chart.assets = FALSE,
-    neighbors = NULL, main = "Random.Portfolios", ...)
+    neighbors = NULL, main = "Random.Portfolios",
+    xlim = NULL, ylim = NULL, ...)
 }
 \arguments{
   \item{RP}{set of random portfolios created by

Modified: pkg/PortfolioAnalytics/man/charts.pso.Rd
===================================================================
--- pkg/PortfolioAnalytics/man/charts.pso.Rd	2013-08-20 21:08:55 UTC (rev 2841)
+++ pkg/PortfolioAnalytics/man/charts.pso.Rd	2013-08-21 00:46:37 UTC (rev 2842)
@@ -5,7 +5,7 @@
   charts.pso(pso, return.col = "mean", risk.col = "ES",
     chart.assets = FALSE, cex.axis = 0.8,
     element.color = "darkgray", neighbors = NULL,
-    main = "PSO.Portfolios", ...)
+    main = "PSO.Portfolios", xlim = NULL, ylim = NULL, ...)
 }
 \arguments{
   \item{pso}{object created by

Modified: pkg/PortfolioAnalytics/man/plot.optimize.portfolio.DEoptim.Rd
===================================================================
--- pkg/PortfolioAnalytics/man/plot.optimize.portfolio.DEoptim.Rd	2013-08-20 21:08:55 UTC (rev 2841)
+++ pkg/PortfolioAnalytics/man/plot.optimize.portfolio.DEoptim.Rd	2013-08-21 00:46:37 UTC (rev 2842)
@@ -4,8 +4,8 @@
 \usage{
   plot.optimize.portfolio.DEoptim(x, ...,
     return.col = "mean", risk.col = "ES",
-    chart.assets = FALSE, neighbors = NULL,
-    main = "optimized portfolio plot")
+    chart.assets = FALSE, neighbors = NULL, xlim = NULL,
+    ylim = NULL, main = "optimized portfolio plot")
 }
 \arguments{
   \item{x}{set of portfolios created by

Modified: pkg/PortfolioAnalytics/man/plot.optimize.portfolio.GenSA.Rd
===================================================================
--- pkg/PortfolioAnalytics/man/plot.optimize.portfolio.GenSA.Rd	2013-08-20 21:08:55 UTC (rev 2841)
+++ pkg/PortfolioAnalytics/man/plot.optimize.portfolio.GenSA.Rd	2013-08-21 00:46:37 UTC (rev 2842)
@@ -6,7 +6,8 @@
     return.col = "mean", risk.col = "ES",
     chart.assets = FALSE, cex.axis = 0.8,
     element.color = "darkgray", neighbors = NULL,
-    main = "GenSA.Portfolios", ...)
+    main = "GenSA.Portfolios", xlim = NULL, ylim = NULL,
+    ...)
 }
 \arguments{
   \item{GenSA}{object created by

Modified: pkg/PortfolioAnalytics/man/plot.optimize.portfolio.ROI.Rd
===================================================================
--- pkg/PortfolioAnalytics/man/plot.optimize.portfolio.ROI.Rd	2013-08-20 21:08:55 UTC (rev 2841)
+++ pkg/PortfolioAnalytics/man/plot.optimize.portfolio.ROI.Rd	2013-08-21 00:46:37 UTC (rev 2842)
@@ -6,7 +6,7 @@
     risk.col = "ES", return.col = "mean",
     chart.assets = chart.assets,
     element.color = "darkgray", neighbors = NULL,
-    main = "ROI.Portfolios", ...)
+    main = "ROI.Portfolios", xlim = NULL, ylim = NULL, ...)
 }
 \arguments{
   \item{ROI}{object created by

Modified: pkg/PortfolioAnalytics/man/plot.optimize.portfolio.Rd
===================================================================
--- pkg/PortfolioAnalytics/man/plot.optimize.portfolio.Rd	2013-08-20 21:08:55 UTC (rev 2841)
+++ pkg/PortfolioAnalytics/man/plot.optimize.portfolio.Rd	2013-08-21 00:46:37 UTC (rev 2842)
@@ -4,7 +4,8 @@
 \usage{
   plot.optimize.portfolio(x, ..., return.col = "mean",
     risk.col = "ES", chart.assets = FALSE,
-    neighbors = NULL, main = "optimized portfolio plot")
+    neighbors = NULL, xlim = NULL, ylim = NULL,
+    main = "optimized portfolio plot")
 }
 \arguments{
   \item{x}{set of portfolios created by

Modified: pkg/PortfolioAnalytics/man/plot.optimize.portfolio.pso.Rd
===================================================================
--- pkg/PortfolioAnalytics/man/plot.optimize.portfolio.pso.Rd	2013-08-20 21:08:55 UTC (rev 2841)
+++ pkg/PortfolioAnalytics/man/plot.optimize.portfolio.pso.Rd	2013-08-21 00:46:37 UTC (rev 2842)
@@ -5,7 +5,7 @@
   plot.optimize.portfolio.pso(pso, return.col = "mean",
     risk.col = "ES", chart.assets = FALSE, cex.axis = 0.8,
     element.color = "darkgray", neighbors = NULL,
-    main = "PSO.Portfolios", ...)
+    main = "PSO.Portfolios", xlim = NULL, ylim = NULL, ...)
 }
 \arguments{
   \item{pso}{object created by

Modified: pkg/PortfolioAnalytics/man/plot.optimize.portfolio.random.Rd
===================================================================
--- pkg/PortfolioAnalytics/man/plot.optimize.portfolio.random.Rd	2013-08-20 21:08:55 UTC (rev 2841)
+++ pkg/PortfolioAnalytics/man/plot.optimize.portfolio.random.Rd	2013-08-21 00:46:37 UTC (rev 2842)
@@ -4,8 +4,8 @@
 \usage{
   plot.optimize.portfolio.random(x, ..., R = NULL,
     return.col = "mean", risk.col = "ES",
-    chart.assets = FALSE, neighbors = NULL,
-    main = "optimized portfolio plot")
+    chart.assets = FALSE, neighbors = NULL, xlim = NULL,
+    ylim = NULL, main = "optimized portfolio plot")
 }
 \arguments{
   \item{x}{set of portfolios created by



More information about the Returnanalytics-commits mailing list