Adjust the legend and axis of a plot

Creating a histogram on my own, how can I sort the legend and make the identifiers look the same (besides the color)?
Or even better, how could I put the legend values directly under the x-axis?

And how can I code which part of the y-axis should be shown (e.g. it should start by 0).

Either it is not possible yet, or I can’t use the documentation (not finding the right).

Please, give some suggestions. Or hint at me if Bokeh is not right for this. I am using IPyNb for this and don’t want to use matplotlib because of the inline functionality.

Greetings

Thomas

Part of my code:

[…]

figure()

hold(False)

#I need to initiate the viewable part of the plot with an invisible rect, else most of the plot’s part would be outside the area

rect([mitten[0]],[1],

 width=0, height=1, plot_width=400, color = None, plot_height=400,

 title = "Histogramm")

hold(True)

for i in range(len(mitten)):

rect([mitten[i]],[anteil[i]/2], 

     width=balkenbreite,

     height=anteil[i],

     plot_width=400, plot_height=400,

     color = colors.pop(),

     plots = "",

     legend = str(gruppenBereiche[i])+"-"+str(gruppenBereiche[i+1]))

xaxis()[0].axis_label=“Bereiche in ?”

yaxis()[0].axis_label=“Häufigkeit in %”

show()

Hi Thomas,

I'm not sure if this is your question on StackOverflow:

  http://stackoverflow.com/questions/22936499/fitting-plot-into-plot-window

If not it happens to ask the same question. There are numerous examples that show how to use the x_range and y_range keyword arguments to set plot ranges, but it is true that this information is missing from the Users Guide. The answer on that link by kpsfire has all the information as well as some examples that show how to set the range in the way you are asking about.

I have also opened a pull request to refresh some of the docs before our upcoming release, including more information on ranges and other topics. You can monitor that at:

  https://github.com/ContinuumIO/bokeh/pull/510

Thanks for your feedback,

Bryan

···

On Apr 8, 2014, at 8:45 AM, Thomas Rusche <[email protected]> wrote:

Creating a histogram on my own, how can I sort the legend and make the identifiers look the same (besides the color)?
Or even better, how could I put the legend values directly under the x-axis?
And how can I code which part of the y-axis should be shown (e.g. it should start by 0).

Either it is not possible yet, or I can't use the documentation (not finding the right).

Please, give some suggestions. Or hint at me if Bokeh is not right for this. I am using IPyNb for this and don't want to use matplotlib because of the inline functionality.

Greetings
Thomas

Part of my code:

[...]

figure()
hold(False)
#I need to initiate the viewable part of the plot with an invisible rect, else most of the plot's part would be outside the area
rect([mitten[0]],[1],
     width=0, height=1, plot_width=400, color = None, plot_height=400,
     title = "Histogramm")
hold(True)
for i in range(len(mitten)):
    rect([mitten[i]],[anteil[i]/2],
         width=balkenbreite,
         height=anteil[i],
         plot_width=400, plot_height=400,
         color = colors.pop(),
         plots = "",
         legend = str(gruppenBereiche[i])+"-"+str(gruppenBereiche[i+1]))
xaxis()[0].axis_label="Bereiche in ?"
yaxis()[0].axis_label="Häufigkeit in %"

show()

--
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/3f3b6e39-9605-436b-9c72-93f689de7d23%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Hello Bryan,

thank You for the response! It really is my question. I have not been sure if SO was the best place to ask (the community might be not very big) so I figured this place here a good place. Before I posted here, I made some improvemens on my own. And now looking, the answers on SO solved my problem :slight_smile:

Besides this, I have a suggestion (?) for the coding of a histogram-function into bokeh/ipython: Say, your series range is from 1 to 98. If you calculate a histogram with numpy.histogram and make a plot with its edges, it appears to be ranged the same. Wouldn’t it be more “smooth” to show it in steps of 10? From 0-10, … , 90-100? This way, it is probably cleaner looking and I think the “room for mis-interpreting (like 99 and 100 also occur in the series)” is negligible - perhaps not the most scientific point of view though.

Keep on the good work
Thomas

···

Am Mittwoch, 9. April 2014 04:46:37 UTC+2 schrieb Bryan Van de ven:

Hi Thomas,

I’m not sure if this is your question on StackOverflow:

    [http://stackoverflow.com/questions/22936499/fitting-plot-into-plot-window](http://stackoverflow.com/questions/22936499/fitting-plot-into-plot-window)

If not it happens to ask the same question. There are numerous examples that show how to use the x_range and y_range keyword arguments to set plot ranges, but it is true that this information is missing from the Users Guide. The answer on that link by kpsfire has all the information as well as some examples that show how to set the range in the way you are asking about.

I have also opened a pull request to refresh some of the docs before our upcoming release, including more information on ranges and other topics. You can monitor that at:

    [https://github.com/ContinuumIO/bokeh/pull/510](https://github.com/ContinuumIO/bokeh/pull/510)

Thanks for your feedback,

Bryan

On Apr 8, 2014, at 8:45 AM, Thomas Rusche [email protected] wrote:

Creating a histogram on my own, how can I sort the legend and make the identifiers look the same (besides the color)?

Or even better, how could I put the legend values directly under the x-axis?

And how can I code which part of the y-axis should be shown (e.g. it should start by 0).

Either it is not possible yet, or I can’t use the documentation (not finding the right).

Please, give some suggestions. Or hint at me if Bokeh is not right for this. I am using IPyNb for this and don’t want to use matplotlib because of the inline functionality.

Greetings

Thomas

Part of my code:

[…]

figure()

hold(False)

#I need to initiate the viewable part of the plot with an invisible rect, else most of the plot’s part would be outside the area

rect([mitten[0]],[1],
width=0, height=1, plot_width=400, color = None, plot_height=400,

 title = "Histogramm")

hold(True)

for i in range(len(mitten)):

rect([mitten[i]],[anteil[i]/2],
     width=balkenbreite,
     height=anteil[i],
     plot_width=400, plot_height=400,
     color = colors.pop(),
     plots = "",
     legend = str(gruppenBereiche[i])+"-"+str(gruppenBereiche[i+1]))

xaxis()[0].axis_label=“Bereiche in ?”

yaxis()[0].axis_label=“Häufigkeit in %”

show()


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/3f3b6e39-9605-436b-9c72-93f689de7d23%40continuum.io.

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