Is there any convenient way to display line chart having point are connected with horizontal/vertical lines without the need to add extra points in between?
Thanks
Is there any convenient way to display line chart having point are connected with horizontal/vertical lines without the need to add extra points in between?
Thanks
Hi,
There's not currently, right now you'd have to compute the "extra" points yourself, or let something like HoloView do it:
Step Chart — HoloViews v1.18.1
But it would probably make sense, and not be too much work, for Step to be its own glyph (or perhaps for line and multiline to be modified. Please make a GitHub issue.
Bryan
On Jul 11, 2017, at 06:20, Meir Tseitlin <[email protected]> wrote:
Is there any convenient way to display line chart having point are connected with horizontal/vertical lines without the need to add extra points in between?
Thanks
--
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/7447f99e-8b72-4d44-99b6-914993faf427%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.
Meir,
Here is a function you could use to get you started.
Granted, this was written quickly and not thoroughly tested - it is just to get you started.
Additionally I have attached a jupyter notebook showing its usage.
def step_line(x, y):
“”"
ingest two lists
set offsets such that the data can be used
to generate a step-line plot.
Steps are thus:
for x’s, repeat all but the first.
for y’s, double up each occurance except the last
Example:
Before:
a = [1, 2, 3, 4, 5]
b = [2, 5, 9, 1, 2]
After:
a = [1, 2, 2, 3, 3, 4, 4, 5, 5]
b = [2, 2, 5, 5, 9, 9, 1, 1, 2]
“”"
x1 =
y1 =
for idx in (range(len(x)*2-1)):
if idx == 0:
print(idx)
x1.append(x[idx])
y1.append(y[idx])
else:
#print('ceil is: ’ + str(math.ceil(idx/2)))
x1.append(x[math.ceil(idx/2)])
y1.append(y[math.floor(idx/2)])
return x1, y1
step_line.ipynb (40.1 KB)
On Tuesday, July 11, 2017 at 7:20:48 AM UTC-4, Meir Tseitlin wrote:
Is there any convenient way to display line chart having point are connected with horizontal/vertical lines without the need to add extra points in between?
Thanks
Thanks - interesting example!
On Monday, July 17, 2017 at 9:48:02 PM UTC+3, Jared Thompson wrote:
Meir,
Here is a function you could use to get you started.
Granted, this was written quickly and not thoroughly tested - it is just to get you started.
Additionally I have attached a jupyter notebook showing its usage.
def step_line(x, y):
“”"
ingest two lists
set offsets such that the data can be used
to generate a step-line plot.
Steps are thus:
- for x’s, repeat all but the first.
- for y’s, double up each occurance except the last
Example:
Before:
a = [1, 2, 3, 4, 5]
b = [2, 5, 9, 1, 2]
After:
a = [1, 2, 2, 3, 3, 4, 4, 5, 5]
b = [2, 2, 5, 5, 9, 9, 1, 1, 2]
“”"
x1 =
y1 =
for idx in (range(len(x)*2-1)):
if idx == 0:
print(idx)
x1.append(x[idx])
y1.append(y[idx])
else:
#print('ceil is: ’ + str(math.ceil(idx/2)))
x1.append(x[math.ceil(idx/2)])
y1.append(y[math.floor(idx/2)])
return x1, y1
On Tuesday, July 11, 2017 at 7:20:48 AM UTC-4, Meir Tseitlin wrote:
Is there any convenient way to display line chart having point are connected with horizontal/vertical lines without the need to add extra points in between?
Thanks