Created
November 23, 2017 19:32
-
-
Save davidgardenier/cba7f598beb0945338afa9225877ff12 to your computer and use it in GitHub Desktop.
Beautiful Bokeh Plots
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from bokeh.io import save, export_svgs | |
from bokeh.plotting import figure, output_file, show | |
filename = "test.svg" | |
p = figure(plot_width=971, plot_height=600) | |
p.circle([1,2,3,4,5], [2,5,8,2,7], size=10) | |
# Set axis titles | |
p.xaxis.axis_label = "Important" | |
p.yaxis.axis_label = "Pressure" | |
# Text variables | |
size = "20pt" | |
font = "ubuntu" | |
style = "normal" | |
alpha = 0.9 | |
# Text fonts | |
p.axis.axis_label_text_font = font | |
p.axis.major_label_text_font = font | |
# Text fonts | |
p.axis.axis_label_text_alpha = alpha | |
p.axis.major_label_text_alpha = alpha | |
# Text sizes | |
p.axis.axis_label_text_font_size = size | |
p.axis.major_label_text_font_size = size | |
# Text style | |
p.axis.axis_label_text_font_style = style | |
p.axis.major_label_text_font_style = style | |
# Change things on all axes | |
p.axis.minor_tick_in = 0 | |
p.axis.minor_tick_out = 0 | |
# Turn off background field | |
p.background_fill_alpha = 0 | |
# SVG | |
p.output_backend = "svg" | |
export_svgs(p, filename=filename) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment