|
451 | 451 | ],
|
452 | 452 | }
|
453 | 453 | fig = px.choropleth_mapbox(
|
454 |
| - geojson=sample_geojson, |
455 |
| - locations=["the_polygon"], |
456 |
| - color=[10], |
457 |
| - mapbox_style="carto-positron", |
458 |
| - zoom=6, |
| 454 | + geojson=sample_geojson, locations=["the_polygon"], color=[10], zoom=6, |
459 | 455 | )
|
460 | 456 | fig.write_html(os.path.join(dir_name, "choropleth_mapbox.html"), auto_play=False)
|
461 | 457 |
|
462 | 458 | import plotly.express as px
|
463 | 459 |
|
464 | 460 | carshare = px.data.carshare()
|
465 | 461 | fig = px.density_mapbox(
|
466 |
| - carshare, |
467 |
| - lat="centroid_lat", |
468 |
| - lon="centroid_lon", |
469 |
| - z="peak_hour", |
470 |
| - mapbox_style="carto-positron", |
| 462 | + carshare, lat="centroid_lat", lon="centroid_lon", z="peak_hour", |
471 | 463 | )
|
472 | 464 | fig.write_html(os.path.join(dir_name, "density_mapbox.html"), auto_play=False)
|
473 | 465 |
|
|
509 | 501 | range_color=[20, 80],
|
510 | 502 | )
|
511 | 503 | fig.write_html(os.path.join(dir_name, "choropleth.html"), auto_play=False)
|
| 504 | + |
| 505 | +import plotly.express as px |
| 506 | + |
| 507 | +tips = px.data.tips() |
| 508 | +fig = px.pie(tips, names="smoker", values="total_bill") |
| 509 | +fig.write_html(os.path.join(dir_name, "pie.html"), auto_play=False) |
| 510 | + |
| 511 | +import plotly.express as px |
| 512 | + |
| 513 | +tips = px.data.tips() |
| 514 | +fig = px.funnel_area(tips, names="smoker", values="total_bill") |
| 515 | +fig.write_html(os.path.join(dir_name, "funnel_area.html"), auto_play=False) |
| 516 | + |
| 517 | +import plotly.express as px |
| 518 | + |
| 519 | +fig = px.treemap( |
| 520 | + names=["Eve", "Cain", "Seth", "Enos", "Noam", "Abel", "Awan", "Enoch", "Azura"], |
| 521 | + parents=["", "Eve", "Eve", "Seth", "Seth", "Eve", "Eve", "Awan", "Eve"], |
| 522 | + values=[10, 14, 12, 10, 2, 6, 6, 4, 4], |
| 523 | +) |
| 524 | +fig.write_html(os.path.join(dir_name, "treemap.html"), auto_play=False) |
| 525 | + |
| 526 | + |
| 527 | +import plotly.express as px |
| 528 | + |
| 529 | +fig = px.sunburst( |
| 530 | + names=["Eve", "Cain", "Seth", "Enos", "Noam", "Abel", "Awan", "Enoch", "Azura"], |
| 531 | + parents=["", "Eve", "Eve", "Seth", "Seth", "Eve", "Eve", "Awan", "Eve"], |
| 532 | + values=[10, 14, 12, 10, 2, 6, 6, 4, 4], |
| 533 | +) |
| 534 | +fig.write_html(os.path.join(dir_name, "sunburst.html"), auto_play=False) |
| 535 | + |
| 536 | + |
| 537 | +import plotly.express as px |
| 538 | + |
| 539 | +fig = px.funnel( |
| 540 | + y=["first", "second", "first", "second"], x=[3,1,4,2], color=["A", "A", "B", "B"] |
| 541 | +) |
| 542 | +fig.write_html(os.path.join(dir_name, "funnel.html"), auto_play=False) |
0 commit comments