https://github.com/allegroai/trains/blob/master/examples/frameworks/matplotlib/matplotlib_example.py
https://allegro.ai/docs/examples/frameworks/matplotlib/matplotlib_example/
I also don't understand why the last chart goes to DEBUG sample instead? the code does not seems to have difference with previous block.
Btw, I am able to isolate the code that causing the problem. It maybe easier for you to debug.
` import numpy as np
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import seaborn as sns
from trains import Task
task = Task.init(project_name='examples', task_name='Matplotlib example')
x = [ 1,2,3]
y = [1,2,3]
x = list(x)
y = list(y)
f, ax = plt.subplots(figsize=(50, 0.7 * len(x)))
sns.barplot(y, x, orient="h", ax=ax)
plt.show() `
EnviousStarfish54
plt.show will capture the figure, that if you call it multiple times, it will add a running number to the figure itself (because the figure might change, and you might want the history)
if you call plt.imshow, it's the equivalent of debug image, hence it will be shown in the debug-samples tab, as an image.
Make sense ?
Is there a way to disable the iteration?
I have these steps in my plot and it create 8 iterations of the charts that create a lot of noise.
plt.plot([0, 1], [0, 1], color="navy", lw=lw, linestyle="--")
plt.xlim([0.0, 1.0])
plt.ylim([0.0, 1.05])
plt.xlabel("False Positive Rate")
plt.ylabel("True Positive Rate")
plt.title("Receiver operating characteristic example")
plt.legend(loc="lower right")
Hi EnviousStarfish54 ,
what version of server and SDK are you using?
can you report this experiment to demo server?
I couldn't report it to demo server, since this involve internal stuff...
The upload itself is in the background.
It should not take long to prepare the plot for sending. Are you experiencing a major delay ?
AgitatedDove14 I believe you mean plt.savefig? I used this function to save my charts, but it does not show up as well.
And the plotting area is completely empty, only some chart titles show up on the left.
it seems that if I don't use plt.show() it won't show up in Allegro, is this a must?
I am not sure what are those example/1/2/3 are, I only have one chart
EnviousStarfish54 is might be - let me check...
I'm looking into the savefig issue, meanwhile you can disable the popup by adding at the top of your code the following:import matplotlib matplotlib.rcParams['backend'] = 'agg' import matplotlib.pyplot matplotlib.pyplot.switch_backend('agg')
It will pop up a window like this, and the program only continues when I close this window.
AgitatedDove14 No, unless I close the window manually.
Disable the matplotlib GUI does work.
Hi EnviousStarfish54
After the pop up do you see the plot on the web UI?
EnviousStarfish54 thanks again for the reproducible code, it seems this is a Web UI bug, I'll keep you updated.
EnviousStarfish54
and the 8 charts are actually identical
Are you plotting the same plot 8 times?
Ok, sorry, this is my mistake, it's actually inside a loop, so this make sense.
and the 8 charts are actually identical
EnviousStarfish54
it seems that if I don't use plt.show() it won't show up in Allegro, is this a must?
Yes , at plt.show / plt.save Trains will capture the plot and send it to the backend.
BTW: when you hover over the empty plot area, do you see the plotly objects, or is it all blank ?
Those charts are saved locally, so I am sure they are not empty charts
hmmm... you mention plt.show() or plt.savefig() will both trigger Trains to log it.
plt.savefig does not trigger logging for me. Only plt.show() does. If you run plt.show() in a python script, it will pop out a new window for matplotlib object and block the entire program, unless you manually close it.
(On Window Machine at least)
EnviousStarfish54 whats your matplotlib version ?
ok, it makes sense. Is there a way to let trains save it without blocking the program ?
No, I mean it capture the plot somehow, as you can see the left side there are a list of plot, but it does not show up.