Skip to content

Commit

Permalink
fix some typos (bokeh#14055)
Browse files Browse the repository at this point in the history
* fix some typos

* fix BokehUserWarning in Ngon

* update comment in airports_map

* remove noqa
  • Loading branch information
mosc9575 authored Sep 8, 2024
1 parent 4f93515 commit df57080
Show file tree
Hide file tree
Showing 11 changed files with 32 additions and 18 deletions.
6 changes: 4 additions & 2 deletions examples/basic/layouts/words_and_plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ def scatter():
colormap = {'Adelie': 'red', 'Chinstrap': 'green', 'Gentoo': 'blue'}
penguins["colors"] = penguins["species"].map(colormap)
source = ColumnDataSource(penguins)
s = figure(title = "Penguin size")
s = figure(title="Penguin size")
s.xaxis.axis_label = "Flipper Length (mm)"
s.yaxis.axis_label = "Body Mass (g)"
s.scatter("flipper_length_mm", "body_mass_g", color="colors", source=source,
fill_alpha=0.2, size=10, legend_group="species")
# Lets move the legend off-canvas!
# Let's move the legend off-canvas!
legend = s.legend[0]
legend.border_line_color = None
legend.orientation = 'horizontal'
Expand All @@ -53,6 +53,7 @@ def hover_plot():
p.add_tools(HoverTool(tooltips=None, renderers=[cr], mode='hline'))
return p


def intro():
return Div(text="""
<h3>Welcome to Layout!</h3>
Expand All @@ -68,6 +69,7 @@ def intro():
use of <code>bokeh.embed</code>.</h4>
""")


show(
layout([
[intro()],
Expand Down
2 changes: 1 addition & 1 deletion examples/basic/scatters/image_url.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
''' An scatter plot showing `Bokeh image logo`_ as marker.
''' A scatter plot showing `Bokeh image logo`_ as marker.
.. bokeh-example-metadata::
:apis: bokeh.plotting.figure.image_url
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
''' An plot of two interactive sliders. The values are updated
''' A plot of two interactive sliders. The values are updated
simultaneously as the slider bars are dragged to different values.
This example demonstrates how ``CustomJS`` callbacks react to user
interaction events.
Expand Down
2 changes: 1 addition & 1 deletion examples/interaction/tools/position_toolbar.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
''' This example demonstrates a basic scatter plot with the toolbar
positioned below the plot, outside of the axes, titles, etc.
positioned below the plot, outside the axes, titles, etc.
.. bokeh-example-metadata::
:apis: bokeh.plotting.figure.toolbar_location, bokeh.plotting.figure.toolbar_sticky, bokeh.plotting.figure.scatter, bokeh.plotting.show
Expand Down
6 changes: 3 additions & 3 deletions examples/models/transform_jitter.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
''' This example demonstrates how to us a jitter transform on coordinate data.
''' This example demonstrates how to use a jitter transform on coordinate data.
.. bokeh-example-metadata::
:apis: bokeh.plotting.figure.circle, bokeh.models.sources.ColumnDataSource, bokeh.models.Circle, bokeh.models.Jitter
Expand All @@ -21,7 +21,7 @@
normal = Jitter(width=0.2, distribution="normal")
uniform = Jitter(width=0.2, distribution="uniform")

p = figure(x_range=(0, 4), y_range=(0,10), toolbar_location=None, x_axis_location="above")
p = figure(x_range=(0, 4), y_range=(0, 10), toolbar_location=None, x_axis_location="above")
p.scatter(x='x', y='y', color='firebrick', source=source, size=5, alpha=0.5)

r1 = p.scatter(x='xn', y='y', color='olive', source=source, size=5, alpha=0.5)
Expand All @@ -33,7 +33,7 @@
size=5, alpha=0.5, visible=False)

label_data = ColumnDataSource(data=dict(
x=[1,2,3], y=[0, 0, 0], t=['Original', 'Normal', 'Uniform'],
x=[1, 2, 3], y=[0, 0, 0], t=['Original', 'Normal', 'Uniform'],
))
label_set = LabelSet(x='x', y='y', text='t', y_offset=-4, source=label_data,
text_baseline="top", text_align='center')
Expand Down
15 changes: 11 additions & 4 deletions examples/output/apis/autoload_static.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,33 +28,40 @@
</html>
""")


class IndexHandler(RequestHandler):
def initialize(self, script):
self.script = script

def get(self):
self.write(template.render(script=self.script))


# Normally, you might save the .js files to some location on disk, and serve
# them from there. Here we us this request handler, just to make the example
# them from there. Here we use this request handler, just to make the example
# completely self-contained.
class JSHandler(RequestHandler):
def initialize(self, js):
self.js = js
def get(self): self.write(self.js)

def get(self):
self.write(self.js)


def make_plot():
colormap = {'Adelie': 'red', 'Chinstrap': 'green', 'Gentoo': 'blue'}
colors = [colormap[x] for x in data['species']]

p = figure(title = "Penguin size")
p = figure(title="Penguin size")
p.xaxis.axis_label = "Bill Length (mm)"
p.yaxis.axis_label = "Body Mass (g)"

p.scatter(data["bill_length_mm"], data["body_mass_g"],
color=colors, fill_alpha=0.2, size=10)
color=colors, fill_alpha=0.2, size=10)

return p


if __name__ == '__main__':
print('Opening Tornado app with embedded Bokeh plot on http://localhost:8080/')

Expand Down
6 changes: 4 additions & 2 deletions examples/plotting/airports_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@

title = "US Airports: Field Elevation > 1500m"


def plot(tile_source: TileSource):
# set to roughly extent of points
# set to rough extents of points
x_range = Range1d(start=airports['x'].min() - 10000, end=airports['x'].max() + 10000, bounds=None)
y_range = Range1d(start=airports['y'].min() - 10000, end=airports['y'].max() + 10000, bounds=None)

Expand All @@ -32,10 +33,11 @@ def plot(tile_source: TileSource):
p.scatter(x='x', y='y', size=10, fill_color="#F46B42", line_color="white", line_width=2, source=airports)
return p


# create a tile source
mq_tile_source = WMTSTileSource(
url="https://tiles.stadiamaps.com/tiles/stamen_terrain/{z}/{x}/{y}{r}.png",
extra_url_vars=dict(r=""), # or "@2x" for 2x scaled (Retina) images
extra_url_vars=dict(r=""), # or "@2x" for 2x scaled (Retina) images
attribution="""
&copy; <a href="https://stadiamaps.com/" target="_blank">Stadia Maps</a>
&copy; <a href="https://stamen.com/" target="_blank">Stamen Design</a>
Expand Down
3 changes: 2 additions & 1 deletion examples/plotting/multi_legend.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'''This example shows a graph with multiple legend. This can be used to depict
a comparision between two datasets. This graph uses stocks dataset.
a comparison between two datasets. This graph uses stocks dataset.
.. bokeh-example-metadata::
:sampledata: stocks
Expand All @@ -17,6 +17,7 @@
def datetime(x):
return np.array(x, dtype=np.datetime64)


p = figure(background_fill_color="#fafafa", x_axis_type="datetime",
width=800, height=350)

Expand Down
2 changes: 1 addition & 1 deletion examples/plotting/us_marriages_divorces_hover.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'''This example shows the number of marriages and divorces in the USA from 1867 to 2011
as a basic line plot. Furthermore a custom tooltip is defined using the Arial font.
as a basic line plot. Furthermore, a custom tooltip is defined using the Arial font.
.. bokeh-example-metadata::
:sampledata: us_marriages_divorces
Expand Down
2 changes: 1 addition & 1 deletion examples/reference/models/Ngon.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
x = np.linspace(-2, 2, N)
y = x**2
radii = np.linspace(0.1, 0.3, N)
n = np.arange(1, N) + 2
n = np.arange(3, N+3)

source = ColumnDataSource(dict(x=x, y=y, radii=radii, n=n))

Expand Down
4 changes: 3 additions & 1 deletion examples/server/app/crossfilter/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
.. _Auto MPG dataset: https://archive.ics.uci.edu/ml/datasets/auto+mpg
'''
import numpy as np
import pandas as pd

from bokeh.layouts import column, row
Expand All @@ -32,6 +33,7 @@
discrete = [x for x in columns if df[x].dtype == object]
continuous = [x for x in columns if x not in discrete]


def create_figure():
xs = df[x.value].values
ys = df[y.value].values
Expand All @@ -50,7 +52,7 @@ def create_figure():
p.yaxis.axis_label = y_title

if x.value in discrete:
p.xaxis.major_label_orientation = pd.np.pi / 4
p.xaxis.major_label_orientation = np.pi / 4

sz = 9
if size.value != 'None':
Expand Down

0 comments on commit df57080

Please sign in to comment.