849729af279adeb657bd3d864df84aa038b79c3d,examples/plotting/file/periodic.py,,,#,7

Before Change


elements = periodic_table.elements[periodic_table.elements["group"] != "-"]

group_range = [str(x) for x in range(1,19)]
period_range = [str(x) for x in reversed(sorted(set(elements["period"])))]

colormap = {
    "alkali metal"         : "//a6cee3",
    "alkaline earth metal" : "/Ǘf78b4",
    "halogen"              : "//fdbf6f",
    "metal"                : "//b2df8a",
    "metalloid"            : "/ችa02c",
    "noble gas"            : "//bbbb88",
    "nonmetal"             : "//baa2a6",
    "transition metal"     : "//e08e79",
}

source = ColumnDataSource(
    data=dict(
        group=[str(x) for x in elements["group"]],
        period=[str(y) for y in elements["period"]],
        symx=[str(x)+":0.1" for x in elements["group"]],
        numbery=[str(x)+":0.8" for x in elements["period"]],
        massy=[str(x)+":0.15" for x in elements["period"]],
        namey=[str(x)+":0.3" for x in elements["period"]],
        sym=elements["symbol"],
        name=elements["name"],
        cpk=elements["CPK"],
        atomic_number=elements["atomic number"],
        electronic=elements["electronic configuration"],
        mass=elements["atomic mass"],
        type=elements["metal"],
        type_color=[colormap[x] for x in elements["metal"]],
    )
)

output_file("periodic.html")

TOOLS = "resize,hover,save"

p = figure(title="Periodic Table", tools=TOOLS,
    x_range=group_range, y_range=period_range)
p.plot_width = 1200
p.toolbar_location = "left"

p.rect("group", "period", 0.9, 0.9, source=source,
    fill_alpha=0.6, color="type_color")

text_props = {
    "source": source,
    "angle": 0,
    "color": "black",
    "text_align": "left",
    "text_baseline": "middle"
}

p.text(x="symx", y="period", text="sym",
    text_font_style="bold", text_font_size="15pt", **text_props)

p.text(x="symx", y="numbery", text="atomic_number",
    text_font_size="9pt", **text_props)

p.text(x="symx", y="namey", text="name",
    text_font_size="6pt", **text_props)

p.text(x="symx", y="massy", text="mass",
    text_font_size="5pt", **text_props)

p.grid.grid_line_color = None

hover = p.select(dict(type=HoverTool))
hover.tooltips = OrderedDict([
    ("name", "@name"),
    ("atomic number", "@atomic_number"),
    ("type", "@type"),

After Change


from bokeh.plotting import figure, show, output_file
from bokeh.sampledata.periodic_table import elements

romans = ["I", "II", "III", "IV", "V", "VI", "VII"]

elements["atomic mass"] = elements["atomic mass"].astype(str)

elements = elements[elements.group != "-"]
elements["period"] = [romans[x-1] for x in elements.period]

group_range = [str(x) for x in range(1, 19)]

colormap = {
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 7

Instances


Project Name: bokeh/bokeh
Commit Name: 849729af279adeb657bd3d864df84aa038b79c3d
Time: 2015-12-22
Author: bryanv@continuum.io
File Name: examples/plotting/file/periodic.py
Class Name:
Method Name:


Project Name: matplotlib/matplotlib
Commit Name: 5608ac37feb7fad002c0e030ba30f4924e8c1fc1
Time: 2018-09-24
Author: anntzer.lee@gmail.com
File Name: examples/statistics/barchart_demo.py
Class Name:
Method Name:


Project Name: QUANTAXIS/QUANTAXIS
Commit Name: d39a96438f653fca7882ae558bf84f103b835f0b
Time: 2020-12-20
Author: nehcuh@szu.edu.cn
File Name: QUANTAXIS/QAFactor/data.py
Class Name: DataApi
Method Name: get_groupby