Skip to content

Add Plotly/Mapbox plotting with temperature coloring#714

Open
AfaqJ wants to merge 11 commits into
e2nIEE:developfrom
AfaqJ:plotting
Open

Add Plotly/Mapbox plotting with temperature coloring#714
AfaqJ wants to merge 11 commits into
e2nIEE:developfrom
AfaqJ:plotting

Conversation

@AfaqJ
Copy link
Copy Markdown
Contributor

@AfaqJ AfaqJ commented Jun 16, 2025

This pull request adds a new way to plot pandapipes networks using Mapbox and Plotly, similar to how it's done in pandapower.

What's added:

A new function create_mapbox_figure(net, ...) in mapbox_plot.py to show the network on a Mapbox map.

It can plot junctions, pipes, external grids, pumps, valves, sources, sinks, and more.

You can color the pipes based on temperature results from net.res_pipe by setting pipe_temperature_coloring=True.

A colorbar is also shown if show_colorbar=True.

The Mapbox access token can be set using set_mapbox_token() or the MAPBOX_ACCESS_TOKEN environment variable.

How to use:
To use Mapbox plotting, just call simple_plot(net, use_mapbox=True, mapbox_access_token="your_token").

Let me know if anything should be changed or improved.

Copy link
Copy Markdown
Contributor

@EPrade EPrade left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey, thank you! Could you add a changelog entry?

Also a test for the new functionalities would be good. And maybe a tutorial as a bonus

@AfaqJ
Copy link
Copy Markdown
Contributor Author

AfaqJ commented Jul 9, 2025

Hello,
I’ve made the following updates:

  • Added a changelog entry under [upcoming release]

  • Added unit tests for the Mapbox functionality in test/plotting/test_mapbox.py

  • Updated mapbox_plot.py with minor improvements

  • Added a tutorial notebook demonstrating the new Mapbox plotting in the tutorials/ folder

Let me know if anything else is needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants