= Obsplot(render="widget", debug=True) op
If using the widget
renderer, debug output will be displayed in JavaScript console. With the jsdom
renderer, it will be displayed directly in the notebook.
Mapping and spatial data
Geo mark
The Geo mark allows to draw geographic features such as points, lines and polygons. These marks data are passed as GeoJSON.
This allows to create choropleth maps such as the following:
-from pyobsplot import Obsplot, Plot
import geopandas as gpd
import pandas as pd
@@ -268,7 +268,7 @@ Geo mark
Of course other marks can be used in conjunction with geo marks. This example represents the density of Walmarts supermarkets and is taken from the Mapping notebook.
-# Load US states from TopoJson with geopandas and convert to GeoJson
= gpd.read_file("data/us-counties-10m.json", layer="states").to_json()
states = gpd.read_file("data/us-counties-10m.json", layer="nation").to_json()
@@ -306,7 +306,7 @@ nation Geo mark
Raster mark
The Raster mark creates an image from spatial data.
Plot allows to do different type of spatial interpolations, such as nearest, which draws voronoi cells around values:
-
+
import polars as pl
= pl.read_csv("data/ca55-south.csv")
@@ -347,7 +347,7 @@ ca55 Raster mark
Or the more recent random walk interpolation:
-
+
"random-walk") flare_map(
diff --git a/gallery_interaction.html b/gallery_interaction.html
index 6fe22e7..379af34 100644
--- a/gallery_interaction.html
+++ b/gallery_interaction.html
@@ -229,7 +229,7 @@ Interaction
Tooltips
The tip mark, introduced in Observable 0.6.7, allows to easily add tooltips to a plot.
-
+
import polars as pl
from pyobsplot import Plot, d3, js
@@ -248,7 +248,7 @@ Tooltips
)
@@ -256,7 +256,7 @@ Tooltips
Crosshair mark
The crosshair mark alows to display the coordinates of the nearest point.
-
+
= pl.read_csv("data/penguins.csv")
penguins
@@ -275,7 +275,7 @@ Plot.plot(Crosshair mark
)
@@ -283,7 +283,7 @@ Crosshair mark
Pointer interaction
More generally, the pointer interaction allows to filter out the closest data point and apply some custom marks to it.
-
+
= stocks.filter(pl.col("Symbol") == "AAPL")
aapl
@@ -314,7 +314,7 @@ Plot.plot(Pointer interaction
)
@@ -324,7 +324,7 @@ Pointer interaction
@@ -246,7 +246,7 @@ light
theme
dark
theme
The dark theme produces plots with a black background and a white foreground color.
-
+
= Obsplot(theme="dark")
op
@@ -262,7 +262,7 @@ op(dark
theme
)
@@ -271,7 +271,7 @@ dark
theme
current
theme
The “current” theme uses a transparent background and a currentColor
foreground, so it should keep the current color theme:
-
+
= Obsplot(theme="current")
op
@@ -287,7 +287,7 @@ op(current
theme
)
@@ -298,7 +298,7 @@ current
theme