|
314 | 314 | )
|
315 | 315 | fig.write_html(os.path.join(dir_name, "line_ternary.html"))
|
316 | 316 |
|
| 317 | +# #### 3D Coordinates |
| 318 | + |
| 319 | +import plotly.express as px |
| 320 | + |
| 321 | +election = px.data.election() |
| 322 | +fig = px.scatter_3d( |
| 323 | + election, |
| 324 | + x="Joly", |
| 325 | + y="Coderre", |
| 326 | + z="Bergeron", |
| 327 | + color="winner", |
| 328 | + size="total", |
| 329 | + hover_name="district", |
| 330 | + symbol="result", |
| 331 | + color_discrete_map={"Joly": "blue", "Bergeron": "green", "Coderre": "red"}, |
| 332 | +) |
| 333 | +fig.write_html(os.path.join(dir_name, "scatter_3d.html")) |
| 334 | + |
| 335 | +import plotly.express as px |
| 336 | + |
| 337 | +election = px.data.election() |
| 338 | +fig = px.line_3d( |
| 339 | + election, x="Joly", y="Coderre", z="Bergeron", color="winner", line_dash="winner" |
| 340 | +) |
| 341 | +fig.write_html(os.path.join(dir_name, "line_3d.html")) |
317 | 342 |
|
318 | 343 | # #### Polar Coordinates
|
319 | 344 |
|
|
360 | 385 |
|
361 | 386 | import plotly.express as px
|
362 | 387 |
|
| 388 | +carshare = px.data.carshare() |
| 389 | +fig = px.scatter_mapbox( |
| 390 | + carshare, |
| 391 | + lat="centroid_lat", |
| 392 | + lon="centroid_lon", |
| 393 | + color="peak_hour", |
| 394 | + size="car_hours", |
| 395 | + color_continuous_scale=px.colors.cyclical.IceFire, |
| 396 | + size_max=15, |
| 397 | + zoom=10, |
| 398 | +) |
| 399 | +fig.write_html(os.path.join(dir_name, "scatter_mapbox.html")) |
| 400 | + |
| 401 | +import plotly.express as px |
| 402 | + |
| 403 | +carshare = px.data.carshare() |
| 404 | +fig = px.line_mapbox( |
| 405 | + carshare, lat="centroid_lat", lon="centroid_lon", color="peak_hour" |
| 406 | +) |
| 407 | +fig.write_html(os.path.join(dir_name, "line_mapbox.html")) |
| 408 | + |
| 409 | +import plotly.express as px |
| 410 | + |
363 | 411 | gapminder = px.data.gapminder()
|
364 | 412 | fig = px.scatter_geo(
|
365 | 413 | gapminder,
|
|
0 commit comments