I want to create a map with PlotlyJS that includes lines and grouped/stacked bar charts. I’ve asked on stackoverflow how to achieve this in general and got a solution that deploys mapboxes. Now I’m trying to convert this into Julia and can’t get the image to appear:
using PlotlyJS, DataFrames, CSV
# create trace for lines (not immediately releveant for mapbox problem)
nm = tempname()
url = "https://raw.githubusercontent.com/plotly/datasets/c34aaa0b1b3cddad335173cb7bc0181897201ee6/2011_february_aa_flight_paths.csv"
download(url, nm)
cord = CSV.read(nm,DataFrame)
M = maximum(cord[:,:cnt])
trace_data = [scattergeo(;locationmode="USA-states",
lon = [cord[1,:start_lon], cord[1,:end_lon]],
lat = [cord[1,:start_lat], cord[1,:end_lat]],
mode = "lines",
line_width = 2,
line_color = "red",
opacity = cord[1,:cnt]/M
)];
# create mapbox data
images_1 = [attr(sourcetype = "raster", source = rand(4, 4), coordinates = [cord[1,:start_lat],cord[1,:start_lon]])]
# create layout and plot
layout = Layout(;showlegend=false, mapbox_style="carto-positron", mapbox_zoom=3, mapbox_layers = images_1)
plot(trace_data, layout)
For testing, I’ve also tried to use a geojson as as an input but did not get a result either. Below is the corresponding code and the content of testGeoJSON.GEOJSON
.
images_2 = [attr(sourcetype = "geojson", source = "testGeoJSON.GEOJSON")]
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [125.6, 10.1]
},
"properties": {
"name": "Dinagat Islands"
}
}
Many thanks!
PS: I’m also greatful for any help on the next step, which is how to convert a PlotlyJS plot into an input for mapboxes. I figure that source = plot(data,layout)
is probably not the right way to go.