bokeh.transform.jitter

Here are the examples of the python api bokeh.transform.jitter taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

4 Examples 7

3 Source : test_transform.py
with MIT License
from rthorst

    def test_basic(self):
        t = bt.jitter("foo", width=0.5, mean=0.1, distribution="normal")
        assert isinstance(t, dict)
        assert set(t) == {"field", "transform"}
        assert t['field'] == "foo"
        assert isinstance(t['transform'], Jitter)
        assert t['transform'].width == 0.5
        assert t['transform'].mean == 0.1
        assert t['transform'].distribution == "normal"
        assert t['transform'].range is None

    def test_defaults(self):

3 Source : test_transform.py
with MIT License
from rthorst

    def test_defaults(self):
        t = bt.jitter("foo", width=0.5)
        assert isinstance(t, dict)
        assert set(t) == {"field", "transform"}
        assert t['field'] == "foo"
        assert isinstance(t['transform'], Jitter)
        assert t['transform'].width == 0.5
        assert t['transform'].mean == 0
        assert t['transform'].distribution == "uniform"
        assert t['transform'].range is None

    def test_with_range(self):

3 Source : test_transform.py
with MIT License
from rthorst

    def test_with_range(self):
        r = FactorRange("a")
        t = bt.jitter("foo", width=0.5, mean=0.1, range=r)
        assert isinstance(t, dict)
        assert set(t) == {"field", "transform"}
        assert t['field'] == "foo"
        assert isinstance(t['transform'], Jitter)
        assert t['transform'].width == 0.5
        assert t['transform'].mean == 0.1
        assert t['transform'].distribution == "uniform"
        assert t['transform'].range is r
        assert t['transform'].range.factors == ["a"]

class Test_linear_cmap(object):

0 Source : parkDataVisulization.py
with MIT License
from richieBao

def categorical_scatter_jitter_SVF(df):
    from bokeh.io import show, output_file,export_svgs
    from bokeh.models import ColumnDataSource
    from bokeh.plotting import figure
    from bokeh.sampledata.commits import data
    from bokeh.transform import jitter
    from bokeh.io import output_notebook, show
    output_notebook()
    output_file("categorical_scatter_jitter_SVF.html")    
    
    # 'SVFep_min', 'SVFep_max', 'SVFep_mean','SVFep_count', 'SVFep_sum', 'SVFep_std', 'SVFep_median',
    # 'SVFep_majority', 'SVFep_minority', 'SVFep_unique', 'SVFep_range','SVFep_nodata',    
    
    # SVFFields=['SVF_mean','SVF_std', 'SVF_min', 'SVF_25%', 'SVF_50%', 'SVF_75%', 'SVF_max']
    SVFFields=['SVFep_min', 'SVFep_max', 'SVFep_mean','SVFep_std', 'SVFep_median','SVFep_majority', 'SVFep_minority', 'SVFep_range',]
    # SVFFields=['SVF_max']
    # DAYS = ['Sun', 'Sat', 'Fri', 'Thu', 'Wed', 'Tue', 'Mon']
    
    data_SVFFields=df[SVFFields]
    print(data_SVFFields.columns)
    
    dfStack=df[SVFFields].stack()
    dfStackDf=pd.DataFrame(dfStack).reset_index()
    dfStackDfAdj=dfStackDf[["level_1",0]].rename(columns={"level_1":"label",0:"value"})

    source=ColumnDataSource(dfStackDfAdj)
    
    p = figure(plot_width=2000, plot_height=500, y_range=SVFFields, x_axis_type='linear',title=" ") #Enum('linear', 'log', 'datetime', 'mercator') plot_width=2000, plot_height=500,1000/200

    p.circle(x='value', y=jitter('label', width=0.6, range=p.y_range),  source=source, alpha=0.3)        
    
    # p.xaxis.formatter.days = ['%Hh']
    p.x_range.range_padding = 0
    p.ygrid.grid_line_color = None
    
    # p.xaxis.axis_label="xaxis_name"
    # p.xaxis.axis_label_text_font_size = "25pt"
    # p.xaxis.axis_label_text_font = "SimHei"
    # p.xaxis.axis_label_text_color = "black"
    # p.axis.minor_tick_in = -3
    # p.axis.minor_tick_out = 6
    p.xaxis.major_tick_line_width = 3
    p.xaxis.major_label_text_font_size='26pt'
    p.yaxis.major_label_text_font_size='26pt'
        
    show(p)
    p.output_backend = "svg"
    export_svgs(p, filename=r"C:\Users\richi\omen-richiebao\omen_sf_paper_2020\01_ spatial structure of parks of the city of Chicago\fig\svfPlot_.svg")

    return dfStackDfAdj

'''