Spaces:
Running
Running
Bokeh figure - changed font, activated tools and tickers
Browse files- analyze_winscore.py +7 -7
analyze_winscore.py
CHANGED
@@ -4,9 +4,8 @@ import csv
|
|
4 |
import random
|
5 |
import numpy as np
|
6 |
from bokeh.plotting import figure
|
7 |
-
from bokeh.models import LabelSet, LogScale
|
8 |
from bokeh.palettes import Turbo256 # A color palette with enough colors
|
9 |
-
from bokeh.models import ColumnDataSource
|
10 |
|
11 |
# Function to fit a polynomial curve and return the x and y values of the fitted curve
|
12 |
def fit_curve(x, y, degree=1):
|
@@ -57,7 +56,7 @@ def get_ldb_records(name_map, csv_file_path):
|
|
57 |
return ldb_records
|
58 |
|
59 |
def create_scatter_plot_with_curve_with_variances_named(category, variance_across_categories, x, y, sizes, model_names, ldb_records):
|
60 |
-
FONTSIZE =
|
61 |
|
62 |
# Remove outliers
|
63 |
x_filtered, y_filtered, x_outliers, y_outliers = remove_outliers(x, y)
|
@@ -129,7 +128,8 @@ def create_scatter_plot_with_curve_with_variances_named(category, variance_acros
|
|
129 |
sizing_mode="stretch_width",
|
130 |
height=800,
|
131 |
#title=f"{category} vs Model Size vs Variance Across Categories",
|
132 |
-
|
|
|
133 |
tooltips=[
|
134 |
("Model", "@model_names"),
|
135 |
("Model Size (B parameters)", "@sizes"),
|
@@ -152,10 +152,10 @@ def create_scatter_plot_with_curve_with_variances_named(category, variance_acros
|
|
152 |
|
153 |
# Add labels (with slight offset to avoid overlap)
|
154 |
p.add_layout(LabelSet(x='x', y='y', text='model_names', source=source_filtered,
|
155 |
-
x_offset=5, y_offset=8, text_font_size=f"{FONTSIZE-
|
156 |
|
157 |
p.add_layout(LabelSet(x='x', y='y', text='model_names', source=source_outliers,
|
158 |
-
x_offset=5, y_offset=8, text_font_size=f"{FONTSIZE-
|
159 |
|
160 |
|
161 |
# Set axis labels
|
@@ -178,7 +178,7 @@ def create_scatter_plot_with_curve_with_variances_named(category, variance_acros
|
|
178 |
|
179 |
p.x_scale = LogScale()
|
180 |
|
181 |
-
p.xaxis.ticker =
|
182 |
p.xaxis.axis_label_text_font_style = "normal"
|
183 |
p.yaxis.axis_label_text_font_style = "normal"
|
184 |
|
|
|
4 |
import random
|
5 |
import numpy as np
|
6 |
from bokeh.plotting import figure
|
7 |
+
from bokeh.models import LabelSet, LogScale, ColumnDataSource, tickers
|
8 |
from bokeh.palettes import Turbo256 # A color palette with enough colors
|
|
|
9 |
|
10 |
# Function to fit a polynomial curve and return the x and y values of the fitted curve
|
11 |
def fit_curve(x, y, degree=1):
|
|
|
56 |
return ldb_records
|
57 |
|
58 |
def create_scatter_plot_with_curve_with_variances_named(category, variance_across_categories, x, y, sizes, model_names, ldb_records):
|
59 |
+
FONTSIZE = 12
|
60 |
|
61 |
# Remove outliers
|
62 |
x_filtered, y_filtered, x_outliers, y_outliers = remove_outliers(x, y)
|
|
|
128 |
sizing_mode="stretch_width",
|
129 |
height=800,
|
130 |
#title=f"{category} vs Model Size vs Variance Across Categories",
|
131 |
+
tools="pan,wheel_zoom,box_zoom,save,reset",
|
132 |
+
active_scroll="wheel_zoom",
|
133 |
tooltips=[
|
134 |
("Model", "@model_names"),
|
135 |
("Model Size (B parameters)", "@sizes"),
|
|
|
152 |
|
153 |
# Add labels (with slight offset to avoid overlap)
|
154 |
p.add_layout(LabelSet(x='x', y='y', text='model_names', source=source_filtered,
|
155 |
+
x_offset=5, y_offset=8, text_font_size=f"{FONTSIZE-2}pt", text_color='black'))
|
156 |
|
157 |
p.add_layout(LabelSet(x='x', y='y', text='model_names', source=source_outliers,
|
158 |
+
x_offset=5, y_offset=8, text_font_size=f"{FONTSIZE-2}pt", text_color='black'))
|
159 |
|
160 |
|
161 |
# Set axis labels
|
|
|
178 |
|
179 |
p.x_scale = LogScale()
|
180 |
|
181 |
+
p.xaxis.ticker = tickers.LogTicker()
|
182 |
p.xaxis.axis_label_text_font_style = "normal"
|
183 |
p.yaxis.axis_label_text_font_style = "normal"
|
184 |
|