[R-SIG-Finance] Trying to plot intraday data on multiple daily plots

Jeffrey Ryan jeffrey.ryan at lemnica.com
Wed Oct 12 16:50:06 CEST 2011


Without the data it makes diagnosing a multistep process for others -
so typically fails to be undertaken.

Working blindly (until I find the time to pull some intraday data and
test), I suspect you may just need to call plot() around your
chart_Series calls.

This is documented behavior - as the actual plotting only occurs from
the 'print' method (in turn calls plot()).  Basically allows for
interactive usage (highly desirable) as well as delayed evaluation
until the chart is ready to be printed.  The downside is that it fails
to print in cases like you describe.

Again, this is just a guess.  You could also work up an example using
getSymbols and yahoo data and plot the weeks or months to give us a
reproducible example.

HTH,
Jeff

On Wed, Oct 12, 2011 at 9:42 AM, Matti Zemack <matti.zemack at gmail.com> wrote:
> Hi all again,
>
> Thanks Joshua, you were absolutely correct in the error you spotted.
> I fixed it by inserting;
>    date<-toString(datte)
> before the chart_Series instruction. (See in edit to my original post below)
>
> But I still couldn't get the plotting from chart_Series to work within the loop.
>
> I was using chart_Series (still in alpha?) because I needed the   par(mfrow=c(5,5))   which is not available in chartSeries.
> And the chart_Series gave me problems with the graphing not working in the loop…
>
> Anyway, I decided to go the pdf-route. I instead use chartSeries with output to a pdf which is stable. And printed the pdf with 16 pages on one page. This is a perfectly working workaround waiting for a stable chart_Series.
>
> Thanks to all package developers, all time you spent on the packages has made life much easier for me.
>
> Regards,
> Matti Zemack
>
>
> -----
> Matti Zemack, Broadcast Technology, Stockholm, Sweden
> matti.zemack at gmail.com
>
> On 12 okt 2011, at 05:05, Joshua Ulrich wrote:
>
>> Your example isn't reproducible and I don't have example data at hand,
>> so here's my guess: "datte" is a Date class object, but (according to
>> ?chart_Series) the subset argument of chart_Series is supposed to be a
>> character string.
>> --
>> Joshua Ulrich  |  FOSS Trading: www.fosstrading.com
>>
>>
>>
>> On Tue, Oct 11, 2011 at 12:47 PM, Matti Zemack <matti.zemack at gmail.com> wrote:
>>> #Now trying to loop per date instead as I understand ONE chart_Series command must be sent for every plot.
>>> #Excuse me for my (probably) ugly way of retrieving the dates for the loop, but I'm new to R….
>>> par(mfrow=c(4,4))
>>> mzGSPCdaily<-to.daily(mzGSPC5)
>>> for (i in 1:length(mzGSPCdaily[,1])) {
>>>  datte<-as.Date(time(mzGSPCdaily[i]))
>>>  #Below print is just for verifying that I receive dates
>
>        datteStr<-toString(datte)
>
>>>  print(datteStr)   #This works and prints the dates "2011-08-01", "2011-08-02"...
>>>  chart_Series(mzGSPC5, subset=datteStr)
>>> }
>
> _______________________________________________
> R-SIG-Finance at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> -- Subscriber-posting only. If you want to post, subscribe first.
> -- Also note that this is not the r-help list where general R questions should go.
>



-- 
Jeffrey Ryan
jeffrey.ryan at lemnica.com

www.lemnica.com
www.esotericR.com



More information about the R-SIG-Finance mailing list