question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Importing pybamm affects style of Matplotlib figures

See original GitHub issue

Describe the bug I prefer to create my own Matplotlib figures without using the sim.plot() function in PyBaMM. Unfortunately, importing pybamm will affect the style of the Matplotlib figures even if I don’t use PyBaMM to create the plots.

To Reproduce In this example, pybamm is imported. Notice the small font size used for axis labels and the red color applied to the line plot.

import matplotlib.pyplot as plt
import pybamm

_, ax = plt.subplots()
ax.plot([1, 3, 5, 3, 8.4])
ax.set_xlabel('X axis')
ax.set_ylabel('Y axis')

plt.show()

fig-pybamm

In this example, pybamm is not imported. Notice the default (larger) font size for axis labels and the blue color for the line plot.

import matplotlib.pyplot as plt

_, ax = plt.subplots()
ax.plot([1, 3, 5, 3, 8.4])
ax.set_xlabel('X axis')
ax.set_ylabel('Y axis')

plt.show()

fig-no-pybamm

Expected behaviour I expect the default figure style to be used when creating plots with Matplotlib.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
tinosulzercommented, Aug 25, 2021

Thanks! Branch from and PR to develop. Typically we would do a branch like issue-1618-plot-style

0reactions
wiggingcommented, Aug 25, 2021

Yes, I can work on this. I looked at the contributing guidelines. After I fork the repository, which branch should I work from? Do I create a branch from main or from develop? And from my branch, to which branch do I make the pull request to?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Source code for pybamm.simulation
Simulation class # import pickle import pybamm import numpy as np import copy ... Other type (?) except NameError: return False # Probably...
Read more >
Style Plots using Matplotlib - GeeksforGeeks
With matplotlib, we can style the plots like, an HTML webpage is styled by using CSS styles. We just need to import style...
Read more >
Python Battery Mathematical Modelling (PyBaMM)
The Python package PyBaMM aims to provide a flexible platform for implementation and comparison of new models and numerical methods.
Read more >
PyBaMM/CHANGELOG.md at develop - GitHub
Parameter sets can now more easily be added via python scripts. ... Parameters can now be imported from a directory having "pybamm" in...
Read more >
Physics-Based Modelling for SEI and Lithium Plating During ...
Parameters that affect the output from the physics-based model are ... PyBaMM Python Battery Mathematical Modelling. i, ii, 4, 14–16, 18–21, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found