x_range(xmin, xmax) with string

Sorry if my question is trivial but I can not find a solution.

I would like to set the xmin value to show the last 5 values. I know I can do this in x_range in figure () where x_range(xmin, xmax) when I have a numeric value but as I do this when I have strings on the x-axis.

from bokeh.io import output_file, show

from bokeh.plotting import figure

x=[1,2,3,4,5,6,7,8,9,10]

xtext = [‘a’, ‘b’, ‘c’, ‘d’, ‘e’, ‘f’, ‘g’, ‘h’, ‘i’, ‘j’]

y=[3, 4, 6, 7, 8, 9, 10, 5, 8, 9]

p = figure(plot_width=400, plot_height=400, x_range= xtext)

p.circle(xtext, y)

output_file(“teste.html”)

show(p)

``

Thanks for any help.

Rafael Pais

plataform: win-64

conda version 4.2.9

bokeh 0.12.2

Hi Rafael,

Did you try passing the truncated list of strings to x_range? If you truncate the list to whatever you want to show, any values corresponding to those not in the list are ignored.

p = figure(plot_width=400, plot_height=400, x_range= xtext[-5:])

Best,

Steve

···

On Sun, May 14, 2017 at 10:10 PM, [email protected] wrote:

Sorry if my question is trivial but I can not find a solution.

I would like to set the xmin value to show the last 5 values. I know I can do this in x_range in figure () where x_range(xmin, xmax) when I have a numeric value but as I do this when I have strings on the x-axis.

from bokeh.io import output_file, show

from bokeh.plotting import figure

x=[1,2,3,4,5,6,7,8,9,10]

xtext = [‘a’, ‘b’, ‘c’, ‘d’, ‘e’, ‘f’, ‘g’, ‘h’, ‘i’, ‘j’]

y=[3, 4, 6, 7, 8, 9, 10, 5, 8, 9]

p = figure(plot_width=400, plot_height=400, x_range= xtext)

p.circle(xtext, y)

output_file(“teste.html”)

show(p)

``

Thanks for any help.

Rafael Pais

plataform: win-64

conda version 4.2.9

bokeh 0.12.2

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/d36fae5f-8852-4a98-aaed-31b94aa97b4a%40continuum.io.

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

Steven Howell
[email protected]
301.531.5195

Hi Steve, thanks

Yes, I tried but if I passing the truncated list, the plots show only the last 5 values (see figure), I would like to plot all values and just set the x-axis min for the last 5.

Rafael

···

Em segunda-feira, 15 de maio de 2017 09:43:43 UTC-3, Steve Howell escreveu:

Hi Rafael,

Did you try passing the truncated list of strings to x_range? If you truncate the list to whatever you want to show, any values corresponding to those not in the list are ignored.

p = figure(plot_width=400, plot_height=400, x_range= xtext[-5:])

Best,

Steve

Steven Howell
[email protected]
301.531.5195

On Sun, May 14, 2017 at 10:10 PM, [email protected] wrote:

Sorry if my question is trivial but I can not find a solution.

I would like to set the xmin value to show the last 5 values. I know I can do this in x_range in figure () where x_range(xmin, xmax) when I have a numeric value but as I do this when I have strings on the x-axis.

from bokeh.io import output_file, show

from bokeh.plotting import figure

x=[1,2,3,4,5,6,7,8,9,10]

xtext = [‘a’, ‘b’, ‘c’, ‘d’, ‘e’, ‘f’, ‘g’, ‘h’, ‘i’, ‘j’]

y=[3, 4, 6, 7, 8, 9, 10, 5, 8, 9]

p = figure(plot_width=400, plot_height=400, x_range= xtext)

p.circle(xtext, y)

output_file(“teste.html”)

show(p)

``

Thanks for any help.

Rafael Pais

plataform: win-64

conda version 4.2.9

bokeh 0.12.2

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/d36fae5f-8852-4a98-aaed-31b94aa97b4a%40continuum.io.

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

To see only a subset of a RactorRange (categorical range), you can set its bounds:

  ranges — Bokeh 3.3.2 Documentation

Thanks,

Bryan

···

On May 15, 2017, at 08:42, [email protected] wrote:

Hi Steve, thanks

Yes, I tried but if I passing the truncated list, the plots show only the last 5 values (see figure), I would like to plot all values and just set the x-axis min for the last 5.

Rafael

Em segunda-feira, 15 de maio de 2017 09:43:43 UTC-3, Steve Howell escreveu:
Hi Rafael,

Did you try passing the truncated list of strings to `x_range`? If you truncate the list to whatever you want to show, any values corresponding to those not in the list are ignored.

p = figure(plot_width=400, plot_height=400, x_range= xtext[-5:])

Best,
Steve

Steven Howell
steven....@gmail.com
301.531.5195

On Sun, May 14, 2017 at 10:10 PM, <[email protected]> wrote:
Sorry if my question is trivial but I can not find a solution.

I would like to set the xmin value to show the last 5 values. I know I can do this in x_range in figure () where x_range(xmin, xmax) when I have a numeric value but as I do this when I have strings on the x-axis.

from bokeh.io import output_file, show
from bokeh.plotting import figure

x=[1,2,3,4,5,6,7,8,9,10]
xtext = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j']

y=[3, 4, 6, 7, 8, 9, 10, 5, 8, 9]

p = figure(plot_width=400, plot_height=400, x_range= xtext)
p.circle(xtext, y)

output_file("teste.html")
show(p)

Thanks for any help.

Rafael Pais

plataform: win-64
conda version 4.2.9
bokeh 0.12.2

--
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 bokeh+un...@continuum.io.
To post to this group, send email to bo...@continuum.io.
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/d36fae5f-8852-4a98-aaed-31b94aa97b4a%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

--
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/91c6d96c-8398-44ce-b11a-66de6437bcda%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

Thanks Bryan, I’ll implement FactorRange().

···

Em segunda-feira, 15 de maio de 2017 11:05:26 UTC-3, Bryan Van de ven escreveu:

To see only a subset of a RactorRange (categorical range), you can set its bounds:

    [http://bokeh.pydata.org/en/latest/docs/reference/models/ranges.html#bokeh.models.ranges.FactorRange.bounds](http://bokeh.pydata.org/en/latest/docs/reference/models/ranges.html#bokeh.models.ranges.FactorRange.bounds)

Thanks,

Bryan

On May 15, 2017, at 08:42, [email protected] wrote:

Hi Steve, thanks

Yes, I tried but if I passing the truncated list, the plots show only the last 5 values (see figure), I would like to plot all values and just set the x-axis min for the last 5.

Rafael

Em segunda-feira, 15 de maio de 2017 09:43:43 UTC-3, Steve Howell escreveu:

Hi Rafael,

Did you try passing the truncated list of strings to x_range? If you truncate the list to whatever you want to show, any values corresponding to those not in the list are ignored.

p = figure(plot_width=400, plot_height=400, x_range= xtext[-5:])

Best,

Steve

Steven Howell

[email protected]

301.531.5195

On Sun, May 14, 2017 at 10:10 PM, [email protected] wrote:

Sorry if my question is trivial but I can not find a solution.

I would like to set the xmin value to show the last 5 values. I know I can do this in x_range in figure () where x_range(xmin, xmax) when I have a numeric value but as I do this when I have strings on the x-axis.

from bokeh.io import output_file, show

from bokeh.plotting import figure

x=[1,2,3,4,5,6,7,8,9,10]

xtext = [‘a’, ‘b’, ‘c’, ‘d’, ‘e’, ‘f’, ‘g’, ‘h’, ‘i’, ‘j’]

y=[3, 4, 6, 7, 8, 9, 10, 5, 8, 9]

p = figure(plot_width=400, plot_height=400, x_range= xtext)

p.circle(xtext, y)

output_file(“teste.html”)

show(p)

Thanks for any help.

Rafael Pais

plataform: win-64

conda version 4.2.9

bokeh 0.12.2


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/d36fae5f-8852-4a98-aaed-31b94aa97b4a%40continuum.io.

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


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/91c6d96c-8398-44ce-b11a-66de6437bcda%40continuum.io.

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

Just to be clear, when you do:

  p = figure(x_range=["some", "list", "of", "strings"])

Bokeh creates a factor range for you. You just need to set the bounds on the one that is created for you.

Bryan

···

On May 16, 2017, at 13:17, [email protected] wrote:

Thanks Bryan, I'll implement FactorRange().

Em segunda-feira, 15 de maio de 2017 11:05:26 UTC-3, Bryan Van de ven escreveu:
To see only a subset of a RactorRange (categorical range), you can set its bounds:

        ranges — Bokeh 3.3.2 Documentation

Thanks,

Bryan

> On May 15, 2017, at 08:42, rafael...@gmail.com wrote:
>
> Hi Steve, thanks
>
> Yes, I tried but if I passing the truncated list, the plots show only the last 5 values (see figure), I would like to plot all values and just set the x-axis min for the last 5.
>
>
>
>
>
>
> Rafael
>
> Em segunda-feira, 15 de maio de 2017 09:43:43 UTC-3, Steve Howell escreveu:
> Hi Rafael,
>
> Did you try passing the truncated list of strings to `x_range`? If you truncate the list to whatever you want to show, any values corresponding to those not in the list are ignored.
>
> p = figure(plot_width=400, plot_height=400, x_range= xtext[-5:])
>
>
> Best,
> Steve
>
> Steven Howell
> steven....@gmail.com
> 301.531.5195
>
>
> On Sun, May 14, 2017 at 10:10 PM, <[email protected]> wrote:
> Sorry if my question is trivial but I can not find a solution.
>
> I would like to set the xmin value to show the last 5 values. I know I can do this in x_range in figure () where x_range(xmin, xmax) when I have a numeric value but as I do this when I have strings on the x-axis.
>
> from bokeh.io import output_file, show
> from bokeh.plotting import figure
>
> x=[1,2,3,4,5,6,7,8,9,10]
> xtext = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j']
>
> y=[3, 4, 6, 7, 8, 9, 10, 5, 8, 9]
>
> p = figure(plot_width=400, plot_height=400, x_range= xtext)
> p.circle(xtext, y)
>
> output_file("teste.html")
> show(p)
>
> Thanks for any help.
>
> Rafael Pais
>
> plataform: win-64
> conda version 4.2.9
> bokeh 0.12.2
>
>
> --
> 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 bokeh+un...@continuum.io.
> To post to this group, send email to bo...@continuum.io.
> To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/d36fae5f-8852-4a98-aaed-31b94aa97b4a%40continuum.io\.
> For more options, visit https://groups.google.com/a/continuum.io/d/optout\.
>
>
> --
> 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 bokeh+un...@continuum.io.
> To post to this group, send email to bo...@continuum.io.
> To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/91c6d96c-8398-44ce-b11a-66de6437bcda%40continuum.io\.
> For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

--
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/adadd2df-4e4f-42ba-a66b-0e3603e390df%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.