Graphing Timeseries without non business day

Hello,

Happy New year 2017 to the bokeh team.

I have been ploting timeseries using the below and I get a nice result but I would like to know if there is an easy way to avoid having non business day on the xaxis as it is creating some horizontal line as per

the attachment.

Thanks again for any help you can provide and for that wonderful tool that bokeh is.

Best,

p = figure(plot_height=600,width=1300, tools="xpan,xwheel_zoom,xbox_zoom,reset",x_axis_type="datetime")
p.line('date','close', alpha=0.8, line_width=3, color='black', source=source)

p.xaxis.formatter=DatetimeTickFormatter(formats=dict(
    seconds=["%d%b%y %H:%M"],
    minutes=["%d%b%y %H:%M"],
    hours=["%d%b%y %H:%M"],
    days=["%d%b%y %H:%M"],
    months=["%d%b%y %H:%M"],
    years=["%d%b%y %H:%M"],
    milliseconds=["%d%b%y H:%M"],
    ))


http://stackoverflow.com/questions/19373759/python-pandas-business-day-range-bdate-range-doesnt-take-1min-freq

maybe make a sub dataframe where you exclude all non-business days?

I’m not sure exactly how you have structured your data, but I think the stackoverflow link could be of help?

Thanks a lot.
I checked my data. The 31rst of December and the the first of January were closed and I have no data for those days so it is all good but in bokeh I see those 2 days.

Is it because I am using x_axis_type=“datetime”? Is there a way around that ?

2016-12-30
16:39:00
2016-12-30T16:39:00.000
7.016
2017-01-02
08:00:00
2017-01-02T08:00:00.000
6.96

···

On Tue, Jan 3, 2017 at 12:56 PM, hi [email protected] wrote:

[http://stackoverflow.com/questions/19373759/python-pandas-business-day-range-bdate-range-doesnt-take-1min-freq](http://stackoverflow.com/questions/19373759/python-pandas-business-day-range-bdate-range-doesnt-take-1min-freq)

maybe make a sub dataframe where you exclude all non-business days?

I’m not sure exactly how you have structured your data, but I think the stackoverflow link could be of help?

You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/f36d85a5-2b40-4b36-8f05-774c1c8102e4%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.


Patrick Houel

96, Kensington High Street
London, W8 4SG

W London : +44-203-66-78763

W New-York :+1- 646-979-4838

M: +44-753-02-12963

[email protected]

I’m not sure if I understand correctly (I’m the same guy as above btw).

But 1st of Jan and 31st of Dec show up in your plot despite the fact that they are not in your df?

That’s kind of odd… I run a time series with the x_axis_type=“datetime” and it doesn’t do that. It just starts at the first date df and ends with the last date of the df.

btw I don’t understand why you show Jan 2nd and Dec 30th data? =P

A user contributed this example with a custom ticker to remove weekend days, some time ago. Perhaps it does what you want:

  https://github.com/bokeh/bokeh/blob/master/examples/plotting/file/custom_datetime_axis.py

Thanks,

Bryan

···

On Jan 3, 2017, at 8:40 AM, [email protected] wrote:

I'm not sure if I understand correctly (I'm the same guy as above btw).

But 1st of Jan and 31st of Dec show up in your plot despite the fact that they are not in your df?

That's kind of odd.. I run a time series with the x_axis_type="datetime" and it doesn't do that. It just starts at the first date df and ends with the last date of the df.

btw I don't understand why you show Jan 2nd and Dec 30th data? =P

--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/0ae3b1a7-4745-49d9-a5f9-eac6634ee150%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

Exactly they are not in my df(see attached).
I showed you the date to prove my point as they are sorted so I jumped from 30th Dec to 2nd of January in my df but in the graph I have them on the x_axis

Could it be linked to the fact I am loading that df and using source.stream(data) or the formatting ?

test.xlsx (84.5 KB)

···

On Tue, Jan 3, 2017 at 2:40 PM, [email protected] wrote:

I’m not sure if I understand correctly (I’m the same guy as above btw).

But 1st of Jan and 31st of Dec show up in your plot despite the fact that they are not in your df?

That’s kind of odd… I run a time series with the x_axis_type=“datetime” and it doesn’t do that. It just starts at the first date df and ends with the last date of the df.

btw I don’t understand why you show Jan 2nd and Dec 30th data? =P

You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/0ae3b1a7-4745-49d9-a5f9-eac6634ee150%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.


Patrick Houel

96, Kensington High Street
London, W8 4SG

W London : +44-203-66-78763

W New-York :+1- 646-979-4838

M: +44-753-02-12963

[email protected]

Line just joins up every pair of adjacent points, it has no notion of separation based on "distance" between points. Options are basically:

* You can "split" a line with nans
* You can use multi_line or mulitple line calls to draw separate lines
* You can reindex somehow and use a custom ticker (the example I linked in the other post)

Thanks,

Bryan

···

On Jan 3, 2017, at 8:49 AM, Patrick Houel <[email protected]> wrote:

Exactly they are not in my df(see attached).
I showed you the date to prove my point as they are sorted so I jumped from 30th Dec to 2nd of January in my df but in the graph I have them on the x_axis

Could it be linked to the fact I am loading that df and using source.stream(data) or the formatting ?

On Tue, Jan 3, 2017 at 2:40 PM, <[email protected]> wrote:
I'm not sure if I understand correctly (I'm the same guy as above btw).

But 1st of Jan and 31st of Dec show up in your plot despite the fact that they are not in your df?

That's kind of odd.. I run a time series with the x_axis_type="datetime" and it doesn't do that. It just starts at the first date df and ends with the last date of the df.

btw I don't understand why you show Jan 2nd and Dec 30th data? =P

--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/0ae3b1a7-4745-49d9-a5f9-eac6634ee150%40continuum.io\.

For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

--
--
Patrick Houel
96, Kensington High Street
London, W8 4SG
W London : +44-203-66-78763
W New-York :+1- 646-979-4838
M: +44-753-02-12963
[email protected]

--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/CACdGsy%3D%2B4Tyg-Un3nZepKTZZsduN5sekPXSeyyu5JbWZ-vJHoA%40mail.gmail.com\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.
<test.xlsx><Capture.PNG>

Brilliant. thanks a lot. I will try to look for example for the first 2 options.

···

On Tue, Jan 3, 2017 at 3:17 PM, Bryan Van de Ven [email protected] wrote:

Line just joins up every pair of adjacent points, it has no notion of separation based on “distance” between points. Options are basically:

  • You can “split” a line with nans

  • You can use multi_line or mulitple line calls to draw separate lines

  • You can reindex somehow and use a custom ticker (the example I linked in the other post)

Thanks,

Bryan

On Jan 3, 2017, at 8:49 AM, Patrick Houel [email protected] wrote:

Exactly they are not in my df(see attached).

I showed you the date to prove my point as they are sorted so I jumped from 30th Dec to 2nd of January in my df but in the graph I have them on the x_axis

Could it be linked to the fact I am loading that df and using source.stream(data) or the formatting ?

On Tue, Jan 3, 2017 at 2:40 PM, [email protected] wrote:

I’m not sure if I understand correctly (I’m the same guy as above btw).

But 1st of Jan and 31st of Dec show up in your plot despite the fact that they are not in your df?

That’s kind of odd… I run a time series with the x_axis_type=“datetime” and it doesn’t do that. It just starts at the first date df and ends with the last date of the df.

btw I don’t understand why you show Jan 2nd and Dec 30th data? =P

You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/0ae3b1a7-4745-49d9-a5f9-eac6634ee150%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Patrick Houel

96, Kensington High Street

London, W8 4SG

W London : +44-203-66-78763

W New-York :+1- 646-979-4838

M: +44-753-02-12963

[email protected]

You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/CACdGsy%3D%2B4Tyg-Un3nZepKTZZsduN5sekPXSeyyu5JbWZ-vJHoA%40mail.gmail.com.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

<test.xlsx><Capture.PNG>

You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/0FDBD1D2-929A-4D52-8802-5930B138FF50%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.


Patrick Houel

96, Kensington High Street
London, W8 4SG

W London : +44-203-66-78763

W New-York :+1- 646-979-4838

M: +44-753-02-12963

[email protected]