Matlab-inspired call syntax for bokeh plots
Project description
bokeh-plot
Installation:
pip install bokeh-plot
Usage:
To load this extension in jupyter notebook:
%load_ext bokeh_plot
The following syntax is supported:
plot([1,4,9]) # x is automatic
plot([1,4,9], '.-') # line and dots
plot([1,2,3], [1,4,9]) # x and y
plot([1,2,3], [1,4,9], '.-') # x, y and line style
Several plots in one figure:
Interactive controls:
click and drag = pan
mouse wheel = zoom,
wheel on x axis = scroll horizontally
wheel on y axis = scroll vertically
Multiple plot syntax (equivalent ways to draw it):
x = [1,5,10]
y1 = [1,4,9]
y2 = [1,8,27]
- plot(x, y1, '.-') # solid line with dots
plot(x, y2, '.-g') # the second plot is green
- plot([y1, y2]) # auto x, auto colors
- plot(x, [y1, y2])
- plot([y1, y2], '.-bg') # blue and green
- plot([y1, y2], style=['.', '.-'], color=['b', 'g'])
- plot(x, y1, '.-', x, y2, '.-g')
The following markers are supported so far:
'.' dots
'-' line
'.-' dots+line
The following colors are supported so far:
'b' blue
'g' green
'r' red
'o' orange
NB The color specifier must go after the marker if both are present.
Legend:
- plot([1,2,3], [1,4,9], legend='plot1')
plot([1,2,3], [2,5,10], legend='plot2')
- plot([y1, y2], legend=['y1', 'y2'])
Legend location:
- plot([1,2,3], [1,4,9], legend='plot1', legend_loc='top_left')
plot([1,2,3], [2,5,10], legend='plot2')
Other legend locations: https://docs.bokeh.org/en/latest/docs/user_guide/styling.html#location
Other uses:
-
semilogx()
,semilogy()
andloglog()
show (semi)logarithmic plots with the same syntax asplot()
. -
hist(x)
displays a histogram of x -
plot(x, y, hover=True)
displays point coordinates on mouse hover. -
plot(x, y, vline=1, hline=1.5, vline_color='red')
in addition to the (x, y) plot displays an infinite vertical line with x=1 and custom red color and an infinite horizontal line with y=1.5 and the default pink color. -
plot(df)
plots all columns of the dataframe as separate lines on the same figure with column names displayed in the legend and with index taken as the x axis values. If the legend grows too long, it can be hidden withlegend_loc='hide'
(new in v0.1.13):
show_df(df)
displays pandas dataframe as a table (new in v0.1.14):
imshow(a)
displays an array as an image:
Complete list of palettes: https://docs.bokeh.org/en/latest/docs/reference/palettes.html
See also a contour plot example in the bokeh gallery page
Comparison to bokeh
bokeh-plot is a thin wrapper over the excellent bokeh library that cuts down the amount of boilerplate code.
The following two cells are equivalent:
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file bokeh_plot-0.1.17.tar.gz
.
File metadata
- Download URL: bokeh_plot-0.1.17.tar.gz
- Upload date:
- Size: 10.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.1.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 511e9e6abb4206b3bbd381e2aca1150cf2bff476fb87dae416d99b6c45d0e3b4 |
|
MD5 | 8ea550e18b681e753ff0284a353d06ae |
|
BLAKE2b-256 | a631909221874c36131a3533fd8c03d77c750b7cf5307a09717aa3ccd4561f33 |
Provenance
File details
Details for the file bokeh_plot-0.1.17-py3-none-any.whl
.
File metadata
- Download URL: bokeh_plot-0.1.17-py3-none-any.whl
- Upload date:
- Size: 12.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.1.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d91c114688b973a7d172f073e445c60019ff5dc8bf53baf13348c6f7b820e546 |
|
MD5 | b9fa9712cd74f5bf396af99bfc73e8ae |
|
BLAKE2b-256 | 369574700db4aeb59189ed8c36f3bed3529519040a1eed77c1cef6c11a81088d |