diff --git a/chart.png b/chart.png new file mode 100644 index 00000000..9c298ce6 Binary files /dev/null and b/chart.png differ diff --git a/ipyleaflet.png b/ipyleaflet.png new file mode 100644 index 00000000..1c766840 Binary files /dev/null and b/ipyleaflet.png differ diff --git a/ipyleaflet_pydeck.png b/ipyleaflet_pydeck.png new file mode 100644 index 00000000..47800cbd Binary files /dev/null and b/ipyleaflet_pydeck.png differ diff --git a/ipyleaflet_pydeck_lonboard_full_axis.png b/ipyleaflet_pydeck_lonboard_full_axis.png new file mode 100644 index 00000000..99cd3055 Binary files /dev/null and b/ipyleaflet_pydeck_lonboard_full_axis.png differ diff --git a/ipyleaflet_pydeck_lonboard_medium_axis.png b/ipyleaflet_pydeck_lonboard_medium_axis.png new file mode 100644 index 00000000..93bbaf4a Binary files /dev/null and b/ipyleaflet_pydeck_lonboard_medium_axis.png differ diff --git a/ipyleaflet_pydeck_lonboard_small_axis.png b/ipyleaflet_pydeck_lonboard_small_axis.png new file mode 100644 index 00000000..06f2feec Binary files /dev/null and b/ipyleaflet_pydeck_lonboard_small_axis.png differ diff --git a/ipyleaflet_pydeck_speed.png b/ipyleaflet_pydeck_speed.png new file mode 100644 index 00000000..b95d233a Binary files /dev/null and b/ipyleaflet_pydeck_speed.png differ diff --git a/tmp_graph.py b/tmp_graph.py new file mode 100644 index 00000000..cc02c515 --- /dev/null +++ b/tmp_graph.py @@ -0,0 +1,52 @@ +import altair as alt +from altair import datum + +import pandas as pd + +data = [ + ["fiona", 232, "FlatGeobuf"], + ["pyogrio", 108, "FlatGeobuf"], + ["GeoArrow", 10, "FlatGeobuf"], + ["fiona", 227, "GeoPackage"], + ["pyogrio", 103, "GeoPackage"], + ["GeoArrow", 10, "GeoPackage"], +] + +# Create the pandas DataFrame +df = pd.DataFrame(data, columns=["Method", "Read time (s)", "File Format"]) + +gp_chart = ( + alt.Chart(df) + .mark_bar() + .encode( + alt.X("Read time (s)"), + alt.Y("File Format", axis=alt.Axis(grid=True)), + alt.Color("Method"), + yOffset="Method", + ) +) +gp_chart = gp_chart.properties( + title="Reading geospatial data to a GeoPandas GeoDataFrame", + # width=alt.Step(80), # Adjust the width of bars if needed +) + +gp_chart +gp_chart.save("chart.png", ppi=200, scale_factor=10) +!pip install vl-convert-python + + + +# Example data +data = pd.DataFrame({"Category": ["A", "B", "C", "D"], "Value": [20, 35, 30, 25]}) + +# Create the Altair chart +chart = alt.Chart(data).mark_bar().encode(x="Category", y="Value") + +# Optionally, add titles and adjust appearance +chart = chart.properties( + title="Bar Chart Example", + width=alt.Step(80), # Adjust the width of bars if needed +) + +# Show the chart +chart diff --git a/tmp_line_graph.py b/tmp_line_graph.py new file mode 100644 index 00000000..aca9bbf9 --- /dev/null +++ b/tmp_line_graph.py @@ -0,0 +1,66 @@ +import altair as alt +from vega_datasets import data + +source = data.stocks() + +source + +alt.Chart(source).mark_line().encode( + x="date:T", + y="price:Q", + color="symbol:N", +) + +import pandas as pd + +data = [ + ["ipyleaflet", 10_000, 1.16], + ["ipyleaflet", 50_000, 5.3], + ["ipyleaflet", 100_000, 12.4], + ["ipyleaflet", 150_000, 17.43], + ["ipyleaflet", 200_000, 24.84], + ["ipyleaflet", 300_000, 50.29], + ["pydeck", 10_000, 0.96], + ["pydeck", 50_000, 3.75], + ["pydeck", 100_000, 6.52], + ["pydeck", 250_000, 17.79], + ["pydeck", 500_000, 35.63], + ["pydeck", 750_000, 55.1], + ["pydeck", 1_000_000, 74.25], + ["lonboard", 100_000, 0.55], + ["lonboard", 500_000, 0.71], + ["lonboard", 1_000_000, 0.92], + ["lonboard", 2_000_000, 1.25], + ["lonboard", 3_000_000, 1.67], + ["lonboard", 5_000_000, 3.32], + ["lonboard", 7_500_000, 4.33], + ["lonboard", 10_000_000, 5.61], + ["lonboard", 15_000_000, 7.95], +] + +columns = ["Library", "# of rows", "Render time (s)"] +df = pd.DataFrame(data, columns=columns) + +color_scale = alt.Scale( + domain=["ipyleaflet", "pydeck"], # , "lonboard"], + range=["#4e79a7", "#f28e2b"], # , "#59A14F"], +) + + +chart = ( + alt.Chart(df) + .mark_line() + .encode( + x=f"{columns[1]}:Q", + y=f"{columns[2]}:Q", + color=alt.Color(shorthand=f"{columns[0]}:N", scale=color_scale), + ) +) +chart = chart.properties( + title="Time to render interactive map by number of points", + # width=alt.Step(80), # Adjust the width of bars if needed +) +chart +# chart.save("ipyleaflet.png", ppi=200, scale_factor=10) +chart.save("ipyleaflet_pydeck.png", ppi=200, scale_factor=10) +# !pip install vl-convert-python