On Dec 10, 2015, at 11:42 AM, Ryan Compton <[email protected]> wrote:
Here's my code (formatted here https://gist.github.com/rcompton/67bb614b86297c970451\):
from collections import OrderedDict
import numpy as np
from bokeh.plotting import figure, show, output_file
from bokeh.models import HoverTool, ColumnDataSource
N = 20
arr2d = np.random.randint(0,10,size=(N,N))
predicted =
actual =
count =
color =
alpha =
the_color = '#cc0000'
for col in range(N):
for rowi in range(N):
predicted.append(str(rowi))
actual.append(str(col))
count.append(arr2d[rowi,col])
a = arr2d[rowi,col]/10.0
alpha.append(a)
color.append(the_color)
source = ColumnDataSource(
data=dict(predicted=predicted, actual=actual, count=count, alphas=alpha, colors=color)
)
p = figure(title='Confusion Matrix',
x_axis_location="above", tools="resize,hover,save",
y_range=list(reversed(actual)), x_range=actual)
p.plot_width = 600
p.plot_height = p.plot_width
rectwidth = 10.9
p.rect('predicted', 'actual', rectwidth, rectwidth, source=source,
color='colors', alpha='alphas',line_width=1, line_color='k')
p.axis.major_label_text_font_size = "12pt"
p.axis.major_label_standoff = 1
p.xaxis.major_label_orientation = np.pi/3
hover = p.select(dict(type=HoverTool))
hover.tooltips = OrderedDict([
('predicted', '@predicted'),
('actual', '@actual'),
('count', '@count'),
])
show(p)
It makes this image: http://i.imgur.com/58z15Yw.png
On Thursday, December 10, 2015 at 12:18:31 PM UTC-5, Bryan Van de ven wrote:
Can you provide a minimal, runnable example that reproduces what you are seeing? It's difficult to offer advice or to debug without that.
Bryan
> On Dec 10, 2015, at 11:12 AM, Ryan Compton <[email protected]> wrote:
>
> I've been trying to modify the les_mis example to use my own data (cf les_mis — Bokeh 0.10.0 documentation )
>
> However, my plots are getting cut off at the min axes, eg http://i.imgur.com/KZ05gmZ.jpg
>
> I'm not sure what's going on and someone else recently ran into the exact same problem here: matrix - python bokeh offset with rect plotting - Stack Overflow
>
> Any idea what we are missing?
>
> --
> 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/61282962-bdb2-4f3c-ac6c-e002f26e2862%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/ca6bb4dd-ba82-405c-bb18-3218f6f086c2%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.