[bokeh] What to do when I can't see the full labels on x-axis?


You will want to increase one or more of the various min_border property values to make more room to accommodate:


Bokeh will automatically add more space for axis labels that are tangential to the axis but its not smart enough to add more space in the direction parallel to an axis.




On Apr 1, 2017, at 16:17, Kasia Rachuta <[email protected]> wrote:


I have a problem where I can't see the full labels on x-axis:

My code:

# Let's visualise the different police districts that the incidents come from.

from bokeh.charts.attributes import CatAttr
from bokeh.models import ColumnDataSource, Range1d, LabelSet, Label

source = ColumnDataSource(neighbourhoods)

p = Bar(incidents, values='PdDistrict', agg='count', plot_width=450, plot_height=450, color='grey',
       xlabel = 'Age', tools=False, outline_line_alpha=0, line_color='white',
         fill_alpha=0.3, label=CatAttr(columns=['PdDistrict'], sort=False))
p.legend.location = None
p.title.text = 'Most incidents occur in the Southern District'

# Trying to add labels:

labels = LabelSet(x='PdDistrict', y='IncidntNum', text='IncidntNum', level='glyph',
              x_offset=-15, y_offset=0, source=source, render_mode='canvas', text_font_size="8pt")

p.legend.border_line_color = 'white'
p.xgrid.grid_line_color = None
p.ygrid.grid_line_color = None

# Removing y-axis
p.ylabel = None
#p.y_axis_location = None
p.yaxis.visible = False

p.axis.minor_tick_in = 0
p.axis.minor_tick_out = 0
p.axis.major_tick_in = 0
p.axis.major_tick_out = 0



The whole thing looks like I want it to do but it cuts down the first part of the dataset. I'm attaching a screenshot of my graph.

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/826f4101-0c30-4c81-aef5-d450f7f1c5c8%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.
<Screen Shot 2017-04-01 at 2.17.12 PM.png>