-
I built a led model with Colour '0.3.13', but as the project grew, I noticed a slow-down in the script due to a growing memory. It seems that with each time ` plotting.plot_single_sd(sd) That last line will increase the memory indefinitly each time it is called. Sorry if this is a false issue, and if it is, how can I solve this problem? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Hi @alban-sol, It is very likely because Matplotlib does not close the figure automatically, try that: import matplotlib.pyplot as plt
import colour
from colour import plotting
sample_sd_data = {
380: 0.048,
385: 0.051,
390: 0.055,
395: 0.060,
400: 0.065,
405: 0.075}
sd = colour.SpectralDistribution(sample_sd_data, name='Sample')
figure, axes = plotting.plot_single_sd(sd)
plt.close(figure) Alternatively, you can also do that: |
Beta Was this translation helpful? Give feedback.
-
Closing this one for now @alban-sol, feel free to comment if it is not resolved. |
Beta Was this translation helpful? Give feedback.
Hi @alban-sol,
It is very likely because Matplotlib does not close the figure automatically, try that:
Alternatively, you can also do that:
plt.close(plotting.plot_single_sd(sd)[0])