Hi everyone,
I want to plot choropleth maps in Julia based on an example from the Plotly Choropleth page for R. But it fails to show the contents of the plot.
The following is the minimum working example.
import HTTP, GeoJSON, DataFrames, CSV, PlotlyJS
# Fetch data
url_geojson = "https://raw.githubusercontent.com/plotly/datasets/master/election.geojson"
fc = GeoJSON.read(HTTP.get(url_geojson).body)
url_content = "https://raw.githubusercontent.com/plotly/datasets/master/election.csv"
df = CSV.read(HTTP.get(url_content).body, DataFrames.DataFrame)
# Plot the map
pTraces = [
PlotlyJS.choroplethmapbox(
geojson=fc, locations=df.district, z=df.Bergeron, color=df.Bergeron,
colorscale="Viridis", featureidkey="property.district",
)
]
pLayout = PlotlyJS.Layout(
mapbox=PlotlyJS.attr(
style="carto-positron",
zoom=9,
center=PlotlyJS.attr(lon=-73.7073, lat=45.5517),
),
)
PlotlyJS.plot(pTraces, pLayout)
The layout of the plot as well as the value range appear to be correct. However, the polygons are missing.
Am I missing something here? Or can anyone providing me with working example of Choropleth mapbox s in Julia?