Is there a better way of making this line plot?

Hi all,

    I just made a line plot in bokeh.

          The data was in a table and I wanted                       a

line for each column in the table.

    I did this using a for-loop              .

Essentially:

        p                 =

figure()

        for x in range(8):

         p.line(x)

    The
        actual code is here:

    I
···

http://nbviewer.jupyter.org/github/birdsarah/bokeh-miscellany/blob/master/Clean%20Teeth.ipynb

couldn’t think of a better way o f doing this, but I just wanted to
check that I’m not missing a trick.

        All feedback welcome.

            Thanks,

              Bird

You could put each column into a "list of lists" (or equivalent) and use MultiLine, is the only thing I can think of.

Bryan

···

On Mar 3, 2016, at 4:06 AM, Sarah Bird <[email protected]> wrote:

Hi all,

I just made a line plot in bokeh.

The data was in a table and I wanted a line for each column in the table.

I did this using a for-loop. Essentially:

p = figure()
for x in range(8):
   p.line(x)

The actual code is here: http://nbviewer.jupyter.org/github/birdsarah/bokeh-miscellany/blob/master/Clean%20Teeth.ipynb

I couldn't think of a better way of doing this, but I just wanted to check that I'm not missing a trick.

All feedback welcome.

Thanks,

Bird

--
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/56D80CBD.9080108%40alum.mit.edu\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

Line Chart? :slight_smile:

This will be a “better” answer when/if we actually make Charts inherit from Figure and share the same interface.

···

On Thu, Mar 3, 2016 at 10:57 AM, Bryan Van de Ven [email protected] wrote:

You could put each column into a “list of lists” (or equivalent) and use MultiLine, is the only thing I can think of.

Bryan

On Mar 3, 2016, at 4:06 AM, Sarah Bird [email protected] wrote:

Hi all,

I just made a line plot in bokeh.

The data was in a table and I wanted a line for each column in the table.

I did this using a for-loop. Essentially:

p = figure()

for x in range(8):

p.line(x)

The actual code is here: http://nbviewer.jupyter.org/github/birdsarah/bokeh-miscellany/blob/master/Clean%20Teeth.ipynb

I couldn’t think of a better way of doing this, but I just wanted to check that I’m not missing a trick.

All feedback welcome.

Thanks,

Bird

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/56D80CBD.9080108%40alum.mit.edu.

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/2D1B8F81-13DA-4CD4-8730-666EBB14F2B8%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Fabio Pliger

Senior Software Engineer, Bokeh

Line Chart was a good
suggestion - it worked better than I thought it would, I ended up with th e following which is all good
until the “further styling” section. Is
there a way to pass
line_width, line_cap, and line_join into the Chart Function that I’ve missed?

              Because even if the Chart followed the Figure interface so chart.xaxis work                            ed (instead of having

to use char t._xaxis) the line
styling wou ld
still be a n
issue.

        `        chart

= Line(

        missing_table.copy(),

        title="Number of missing teeth by age group in UK. Source:

Adult Dental Health Survey 2009",

        legend='top_right',

        palette=Spectral8,

        xlabel='Number of teeth',

        ylabel='Count',

        outline_line_color=None,

        width=900,

        responsive=True

    )

    chart.title_text_align = 'left'

    chart.title_text_font_size = '12pt'

    chart._xaxis.axis_label_text_font_size = '10pt'

    chart._yaxis.axis_label_text_font_size = '10pt'

    # Further styling

    from bokeh.models import Line as LineGlyph, Legend

    for line in chart.select(LineGlyph):

        line.line_width = 5

        line.line_cap = 'round'

        line.line_join = 'round'

    for legend in chart.select(Legend):

        legend.border_line_color = None

    show(chart)``

  `
···

On 3/3/16 9:02 AM, Fabio Pliger wrote:

Line Chart? :slight_smile:

    This will be a "better" answer when/if we actually make Charts

inherit from Figure and share the same interface.

      On Thu, Mar 3, 2016 at 10:57 AM, Bryan

Van de Ven [email protected]
wrote:

        You could

put each column into a “list of lists” (or equivalent) and
use MultiLine, is the only thing I can think of.

        Bryan


            > On Mar 3, 2016, at 4:06 AM, Sarah Bird <                >

wrote:

Hi all,

I just made a line plot in bokeh.

The data was in a table and I wanted a line for
each column in the table.

I did this using a for-loop. Essentially:

p = figure()
for x in range(8):
p.line(x)

The actual code is here: >
I couldn’t think of a better way of doing this, but
I just wanted to check that I’m not missing a trick.

All feedback welcome.

Thanks,

Bird


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 .
To post to this group, send email to .
To view this discussion on the web visit .
For more options, visit .

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 .
To post to this group, send email to .

To view this discussion on the web visit .


** Fabio
Pliger**

  •                            Senior
    

Software Engineer, Bokeh*

  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/CAPVmnqBtXXwg0Yk7uuCChwYMxDPC6by%2BuC4teFKC5q04%3D2KCXQ%40mail.gmail.com?utm_medium=email&utm_source=footer)      .

For more options, visit .


Sarah Bird
Developer, Bokeh

    [
      ![Continuum Analytics](http://docs.continuum.io/_static/img/ContinuumWordmark.png)
    ](http://continuum.io)

[email protected]

http://nbviewer.jupyter.org/github/birdsarah/bokeh-miscellany/blob/master/Clean%20Teeth.ipynb

[email protected]
[email protected]
https://groups.google.com/a/continuum.io/d/msgid/bokeh/56D80CBD.9080108%40alum.mit.edu
https://groups.google.com/a/continuum.io/d/optout

[email protected]
[email protected]
https://groups.google.com/a/continuum.io/d/msgid/bokeh/2D1B8F81-13DA-4CD4-8730-666EBB14F2B8%40continuum.io
For more options, visit .

https://groups.google.com/a/continuum.io/d/optout
https://groups.google.com/a/continuum.io/d/msgid/bokeh/CAPVmnqBtXXwg0Yk7uuCChwYMxDPC6by%2BuC4teFKC5q04%3D2KCXQ%40mail.gmail.com
https://groups.google.com/a/continuum.io/d/optout