[R-SIG-Finance] [R-sig-finance] Plot TS-matrix as a surface

R@Nabble vlanschot at yahoo.com
Wed Mar 4 13:56:53 CET 2009


Jeff,

I've taken the liberty to download and adjust your preliminary function code
for persp() for my purposes, i.e. simply replacing your ts-matrix with my
own doesn't work. Unfortunately (due to my limited expertise of R) I haven't
been able to get the lables for the y- and x-axis (you use trans3d, etc.)
replaced with my own "rownames" and "colnames". For now, I will simply keep
the x-axis as 1:nrows and y-axis as 1:ncols, i.e. the default persp
settings.

Request/suggestion: don't know whether it would be possible for you in your
final code to simply allow a user to feed a zoo/ts matrix as main input,
perhaps by specifying the date-format, and for your function then to
automatically create the axes labels.

Still, your preliminary code has enabled me more flexibility re inputs for
the persp function and will leave it for now as is. 

Paul,

Sorry, but I haven't had time yet to play around with the tframe package.

Thx again to both.

PS


R at Nabble wrote:
> 
> Jeff and Paul,
> 
> Thanks for the suggestions. Jeff's png seems to reflect what I need, will
> investigate/apply, and report back.
> 
> PS
> 
> Paul Gilbert wrote:
>> 
>> In the tframePlus package there is a function called tfpersp() that does 
>> this.  I'm sure it can be improved, I've never been really happy with 
>> it. But you might want to compare, to be sure you are improving it.
>> 
>> Paul
>> 
>> Jeff Ryan wrote:
>>> PS,
>>> 
>>> I have been working on adding a chartSeries3d function to quantmod.
>>> The code isn't in place yet, but it relies on persp, and some extra
>>> manipulation to offer much better axis labeling.  It is designed for
>>> xts/zoo structures in particular.  The final code will work for any
>>> time-series.
>>> 
>>> This should be in the next release of quantmod, but I've posted the
>>> alpha code and a .png here:
>>> 
>>> http://www.quantmod.com/example/chartSeries3d
>>> 
>>> HTH,
>>> Jeff
>>> 
>>> 
>>> R/Finance 2009: Applied Finance with R
>>> April 24, 25 2009 Chicago, IL USA
>>> http://www.RinFinance.com
>>> 
>>> 
>>> On Thu, Feb 26, 2009 at 8:20 AM, R at Nabble <vlanschot at yahoo.com> wrote:
>>> 
>>>>Thank you Enrico. Your example helped me to solve a (embarrasingly
basic)
>>>>error in my code.
>>>>
>>>>Plots fine now.
>>>>
>>>>Thx again.
>>>>
>>>>PS
>>>>
>>>>Enrico Schumann wrote:
>>>>
>>>>>it should be helpful to give a little code example, or at least the
>>>>>content
>>>>>of the error messages that you received.
>>>>>
>>>>>the following gives me a perspective plot...
>>>>>
>>>>>require(zoo)
>>>>>nC     <- 10  # columns
>>>>>nO     <- 100 # observations
>>>>>dataM  <- array(runif(nC * nO), dim=c(nO, nC))
>>>>>zz     <- zoo(dataM, 1:nO)
>>>>>persp(1:nO,1:nC,zz)
>>>>>
>>>>>
>>>>>regards
>>>>>enrico
>>>>>-----Ursprüngliche Nachricht-----
>>>>>Von: r-sig-finance-bounces at stat.math.ethz.ch
>>>>>[mailto:r-sig-finance-bounces at stat.math.ethz.ch] Im Auftrag von
R at Nabble
>>>>>Gesendet: Donnerstag, 26. Februar 2009 12:26
>>>>>An: r-sig-finance at stat.math.ethz.ch
>>>>>Betreff: [R-SIG-Finance] [R-sig-finance] Plot TS-matrix as a surface
>>>>>
>>>>>
>>>>>I'd like to be able to plot a time-series matrix (i.e. first col
contains
>>>>>sorted dates, rest of cols contains non-sorted data, with headings at
the
>>>>>top; current format is as a zoo object) as a surface/3D chart. The
>>>>>function
>>>>>persp() is giving me errors, even if I transform data as core data,
etc.
>>>>>
>>>>>Any suggestions / other functions available?
>>>>>
>>>>>Thx,
>>>>>
>>>>>PS
>>>>>--
>>>>>View this message in context:
>>>>>http://www.nabble.com/Plot-TS-matrix-as-a-surface-tp22222236p22222236.html
>>>>>Sent from the Rmetrics mailing list archive at Nabble.com.
>>>>>
>>>>>_______________________________________________
>>>>>R-SIG-Finance at stat.math.ethz.ch mailing list
>>>>>https://stat.ethz.ch/mailman/listinfo/r-sig-finance
>>>>>-- Subscriber-posting only.
>>>>>-- If you want to post, subscribe first.
>>>>>No virus found in this incoming message.
>>>>>Checked by AVG - www.avg.com
>>>>>
>>>>>
>>>>>06:40:00
>>>>>
>>>>>_______________________________________________
>>>>>R-SIG-Finance at stat.math.ethz.ch mailing list
>>>>>https://stat.ethz.ch/mailman/listinfo/r-sig-finance
>>>>>-- Subscriber-posting only.
>>>>>-- If you want to post, subscribe first.
>>>>>
>>>>>
>>>>
>>>>--
>>>>View this message in context:
http://www.nabble.com/Plot-TS-matrix-as-a-surface-tp22222236p22225107.html
>>>>Sent from the Rmetrics mailing list archive at Nabble.com.
>>>>
>>>>_______________________________________________
>>>>R-SIG-Finance at stat.math.ethz.ch mailing list
>>>>https://stat.ethz.ch/mailman/listinfo/r-sig-finance
>>>>-- Subscriber-posting only.
>>>>-- If you want to post, subscribe first.
>>> 
>>> 
>>> 
>>> 
>> ====================================================================================
>> 
>> La version française suit le texte anglais.
>> 
>> ------------------------------------------------------------------------------------
>> 
>> This email may contain privileged and/or confidential in...{{dropped:26}}
>> 
>> _______________________________________________
>> R-SIG-Finance at stat.math.ethz.ch mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
>> -- Subscriber-posting only.
>> -- If you want to post, subscribe first.
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Plot-TS-matrix-as-a-surface-tp22222236p22329485.html
Sent from the Rmetrics mailing list archive at Nabble.com.



More information about the R-SIG-Finance mailing list