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

Paul Gilbert pgilbert at bank-banque-canada.ca
Wed Mar 4 17:43:26 CET 2009



R at Nabble wrote:
> 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.

Well, it could be that I am missing something important in what you are 
trying to do, but you might want to look at it (tfpersp in tframePlus). 
It certainly allows you to pass your own labels, and most of the other 
arguments to persp. It just tries to make default guesses that work for 
time series, and provide windowing.

Paul
> 
> 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.
>>>
>>>
>>
>>
> 
====================================================================================

La version française suit le texte anglais.

------------------------------------------------------------------------------------

This email may contain privileged and/or confidential information, and the Bank of
Canada does not waive any related rights. Any distribution, use, or copying of this
email or the information it contains by other than the intended recipient is
unauthorized. If you received this email in error please delete it immediately from
your system and notify the sender promptly by email that you have done so. 

------------------------------------------------------------------------------------

Le présent courriel peut contenir de l'information privilégiée ou confidentielle.
La Banque du Canada ne renonce pas aux droits qui s'y rapportent. Toute diffusion,
utilisation ou copie de ce courriel ou des renseignements qu'il contient par une
personne autre que le ou les destinataires désignés est interdite. Si vous recevez
ce courriel par erreur, veuillez le supprimer immédiatement et envoyer sans délai à
l'expéditeur un message électronique pour l'aviser que vous avez éliminé de votre
ordinateur toute copie du courriel reçu.


More information about the R-SIG-Finance mailing list