I was playing with segments, and everything was find as long as I used lists of integers, however I had a need come up where I needed/wanted to put time on the x axis and integers on the y axis. (It was to show durations(x axis in time) of behavior and the frequency/popularity(y-axis) of those patterns).
I was trying to do this with some dataframes in pandas and was not getting what I expected.
When I simplified the problem to the below I did not get an x-axis that I was expecting.
import bokeh.plotting as bp
import datetime
bp.output_file(“categorical.html”, title=“categorical.py example”)
bp.segment([datetime.date(2014,1,1)], [3], [datetime.date(2014,1,7)], [3],
line_width=20, line_color=“green”, title=“Dot Plot”)
bp.figure()
bp.show()
my x axis I was expecting to be some dates or some sort of readable range, however the tick marks are things like “1.3886e+12” “1.3887e+12”, is that expected?
I will note, in the examples files I see lots of references to:
figure(x_axis_type = "datetime",
such as in:
[http://bokeh.pydata.org/docs/gallery/stocks.html](http://bokeh.pydata.org/docs/gallery/stocks.html)
and I can run that example and it works.
I did go back into my plot and add in:
bp.figure(x_axis_type="datetime")
although that did not change anything - is it because I am using a segment - or have I erred in some other way?
I can see the x_asis_type here:
[https://github.com/ContinuumIO/bokeh/blob/5b8c12200c1170c1c6a76d8afb22cddf1a7efb1d/bokeh/plotting_helpers.py](https://github.com/ContinuumIO/bokeh/blob/5b8c12200c1170c1c6a76d8afb22cddf1a7efb1d/bokeh/plotting_helpers.py)
···
On Thu, Jun 19, 2014 at 9:19 PM, jared [email protected] wrote:
I was playing with segments, and everything was find as long as I used lists of integers, however I had a need come up where I needed/wanted to put time on the x axis and integers on the y axis. (It was to show durations(x axis in time) of behavior and the frequency/popularity(y-axis) of those patterns).
I was trying to do this with some dataframes in pandas and was not getting what I expected.
When I simplified the problem to the below I did not get an x-axis that I was expecting.
import bokeh.plotting as bp
import datetime
bp.output_file(“categorical.html”, title=“categorical.py example”)
bp.segment([datetime.date(2014,1,1)], [3], [datetime.date(2014,1,7)], [3],
line_width=20, line_color=“green”, title=“Dot Plot”)
bp.figure()
bp.show()
my x axis I was expecting to be some dates or some sort of readable range, however the tick marks are things like “1.3886e+12” “1.3887e+12”, is that expected?
Hi Jared,
Unfortunately you encountered that error through our fault. Our documentation will require significant upgrading as we prepare for SciPy, so hopefully you won’t encounter a similar situation in the future, but at least for now I can help fix your problem quite simply.
The call to figure()
should be placed before those to any renderers. Calling figure()
means to create a new figure, i.e. a new plot, upon which to add subsequent renderers. Therefore your code should work if written as shown here: http://nbviewer.ipython.org/github/kdodia/examples/blob/master/Datetime%20Plotting.ipynb
Karan
···
On Thursday, June 19, 2014 9:09:41 PM UTC-5, Jared Thompson wrote:
I will note, in the examples files I see lots of references to:
figure(x_axis_type = "datetime",
such as in:
[http://bokeh.pydata.org/docs/gallery/stocks.html](http://bokeh.pydata.org/docs/gallery/stocks.html)
and I can run that example and it works.
I did go back into my plot and add in:
bp.figure(x_axis_type="datetime")
although that did not change anything - is it because I am using a segment - or have I erred in some other way?
I can see the x_asis_type here:
[https://github.com/ContinuumIO/bokeh/blob/5b8c12200c1170c1c6a76d8afb22cddf1a7efb1d/bokeh/plotting_helpers.py](https://github.com/ContinuumIO/bokeh/blob/5b8c12200c1170c1c6a76d8afb22cddf1a7efb1d/bokeh/plotting_helpers.py)
On Thu, Jun 19, 2014 at 9:19 PM, jared [email protected] wrote:
I was playing with segments, and everything was find as long as I used lists of integers, however I had a need come up where I needed/wanted to put time on the x axis and integers on the y axis. (It was to show durations(x axis in time) of behavior and the frequency/popularity(y-axis) of those patterns).
I was trying to do this with some dataframes in pandas and was not getting what I expected.
When I simplified the problem to the below I did not get an x-axis that I was expecting.
import bokeh.plotting as bp
import datetime
bp.output_file(“categorical.html”, title=“categorical.py example”)
bp.segment([datetime.date(2014,1,1)], [3], [datetime.date(2014,1,7)], [3],
line_width=20, line_color=“green”, title=“Dot Plot”)
bp.figure()
bp.show()
my x axis I was expecting to be some dates or some sort of readable range, however the tick marks are things like “1.3886e+12” “1.3887e+12”, is that expected?
ok, I see my mistake, the x_axis_type goes inside the bp.secgemnt().
I will file the bug report you eluded to on the json.
Thanks for your help
···
On Thu, Jun 19, 2014 at 10:54 PM, [email protected] wrote:
Hi Jared,
Unfortunately you encountered that error through our fault. Our documentation will require significant upgrading as we prepare for SciPy, so hopefully you won’t encounter a similar situation in the future, but at least for now I can help fix your problem quite simply.
The call to figure()
should be placed before those to any renderers. Calling figure()
means to create a new figure, i.e. a new plot, upon which to add subsequent renderers. Therefore your code should work if written as shown here: http://nbviewer.ipython.org/github/kdodia/examples/blob/master/Datetime%20Plotting.ipynb
Karan
On Thursday, June 19, 2014 9:09:41 PM UTC-5, Jared Thompson wrote:
I will note, in the examples files I see lots of references to:
figure(x_axis_type = "datetime",
such as in:
[http://bokeh.pydata.org/docs/gallery/stocks.html](http://bokeh.pydata.org/docs/gallery/stocks.html)
and I can run that example and it works.
I did go back into my plot and add in:
bp.figure(x_axis_type="datetime")
although that did not change anything - is it because I am using a segment - or have I erred in some other way?
I can see the x_asis_type here:
[https://github.com/ContinuumIO/bokeh/blob/5b8c12200c1170c1c6a76d8afb22cddf1a7efb1d/bokeh/plotting_helpers.py](https://github.com/ContinuumIO/bokeh/blob/5b8c12200c1170c1c6a76d8afb22cddf1a7efb1d/bokeh/plotting_helpers.py)
On Thu, Jun 19, 2014 at 9:19 PM, jared [email protected] wrote:
I was playing with segments, and everything was find as long as I used lists of integers, however I had a need come up where I needed/wanted to put time on the x axis and integers on the y axis. (It was to show durations(x axis in time) of behavior and the frequency/popularity(y-axis) of those patterns).
I was trying to do this with some dataframes in pandas and was not getting what I expected.
When I simplified the problem to the below I did not get an x-axis that I was expecting.
import bokeh.plotting as bp
import datetime
bp.output_file(“categorical.html”, title=“categorical.py example”)
bp.segment([datetime.date(2014,1,1)], [3], [datetime.date(2014,1,7)], [3],
line_width=20, line_color=“green”, title=“Dot Plot”)
bp.figure()
bp.show()
my x axis I was expecting to be some dates or some sort of readable range, however the tick marks are things like “1.3886e+12” “1.3887e+12”, is that expected?
–
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/0b4c9d10-102c-4c6f-aca3-fca9627fd040%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.