Add Tidy3D Matplotlib Styles on Import#2428
Conversation
|
This PR might need more testing over a broader set of notebooks to see if the new styles break anything. The example is taken from https://github.com/flexcompute/tidy3d-notebooks/blob/develop/Simulation.ipynb. Additionally, the style presets are quite minimal for now and can (should) be extended to improve the display of the plots. |
|
Overall looking great @frederikschubertflex thanks for this! @tomflexcompute do you have any other preferences for an improved standard tidy3d style? Like thicker axes, etc. We can add this in here. |
|
So the reset styles functionality needs to be added to the changelog.md and also to somewhere in the sphinx documentation too |
I added an entry in the CHANGELOG.md but we need to discuss where to document it in the sphinx docs. |
0a4d127 to
c1f9fc8
Compare
yaugenst-flex
left a comment
There was a problem hiding this comment.
Thanks @frederikschubertflex overall looks great, just a couple of minor comments.
One general comment/question I had is whether it would make sense to create a custom matplotlib style sheet that we could just load on import? Not sure if that's better or not.
Good point! I was also thinking about this but did not want to add the complexity of distributing a separate style file. This was the approach with the least amount of friction, but I am happy to change it if you feel more comfortable with the external style sheet approach. |
Is there something that needs to be done beyond just having it live in the And actually one more question: Do we have some sample plots (or notebook runs) that show the new styles? |
No, you are correct! We can use it as |
I feel like it might be worth it then. It'll be easier to reuse down the line, since the style might make it into other packages too or perhaps we can even expose it to users if they want to use it. |
|
I changed the setup to use the |
daquinteroflex
left a comment
There was a problem hiding this comment.
Thanks for this very comprehensive upgrade! Looks good to me apart from the question I asked on the cycler, to be sure those are the colors we want?
|
We'll of course need to do the notebooks PR after this is merged to develop maybe before the next release. |
|
Happy to merge whenever imo! Maybe we should run notebooks after #2433 is merged though to catch any issues with that |




This PR addresses #1713 and sets the global Matplotlib styles via the
rcParamsto a basic set of styles that follow that Flexcompute design brand.The
reset_previous_stylefunction is not yet exported as part of the public API.Note: The PR also contains a refactoring commit that converts the Flexcompute color map to simple hex strings and refactors the single place that used the hex numbers (tidy3d/material_library/util.py) to simplify the code.
Closes #1713