Examples: query, "exact match", wildcard*, wild?ard, wild*rd
Fuzzy search: cake~ (finds cakes, bake)
Term boost: "red velvet"^4, chocolate^2
Field grouping: tags:(+work -"fun-stuff")
Escaping: Escape characters +-&|!(){}[]^"~*?:\ with \, e.g. \+
Range search: properties.timestamp:[1587729413488 TO *] (inclusive), properties.title:{A TO Z}(excluding A and Z)
Combinations: chocolate AND vanilla, chocolate OR vanilla, (chocolate OR vanilla) NOT "vanilla pudding"
Field search: properties.title:"The Title" AND text
Answered
I Hit A Issue That I Cannot See My Matplotlib Plot, But It Was Shown In The Panel. Any Idea?

I hit a issue that I cannot see my matplotlib plot, but it was shown in the panel. any idea?

  
  
Posted 4 years ago
Votes Newest

Answers 30


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)

  
  
Posted 4 years ago

EnviousStarfish54 thanks again for the reproducible code, it seems this is a Web UI bug, I'll keep you updated.

  
  
Posted 4 years ago

This will make the plotting fail

  
  
Posted 4 years ago

It will pop up a window like this, and the program only continues when I close this window.

  
  
Posted 4 years ago

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() `

  
  
Posted 4 years ago

Thanks EnviousStarfish54 !

  
  
Posted 4 years ago

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.

  
  
Posted 4 years ago

The upload itself is in the background.
It should not take long to prepare the plot for sending. Are you experiencing a major delay ?

  
  
Posted 4 years ago

and the 8 charts are actually identical

  
  
Posted 4 years ago

ok, it makes sense. Is there a way to let trains save it without blocking the program ?

  
  
Posted 4 years ago

Those charts are saved locally, so I am sure they are not empty charts

  
  
Posted 4 years ago

0.16.1

  
  
Posted 4 years ago

I couldn't report it to demo server, since this involve internal stuff...

  
  
Posted 4 years ago

Hi EnviousStarfish54
After the pop up do you see the plot on the web UI?

  
  
Posted 4 years ago

I am not sure what are those example/1/2/3 are, I only have one chart

  
  
Posted 4 years ago

EnviousStarfish54 is might be - let me check...

  
  
Posted 4 years ago

matplotlib.version
'3.1.3'

  
  
Posted 4 years ago

AgitatedDove14 I believe you mean plt.savefig? I used this function to save my charts, but it does not show up as well.

  
  
Posted 4 years ago

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 ?

  
  
Posted 4 years ago

EnviousStarfish54 whats your matplotlib version ?

  
  
Posted 4 years ago

it seems that if I don't use plt.show() it won't show up in Allegro, is this a must?

  
  
Posted 4 years ago

EnviousStarfish54

and the 8 charts are actually identical

Are you plotting the same plot 8 times?

  
  
Posted 4 years ago

And the plotting area is completely empty, only some chart titles show up on the left.

  
  
Posted 4 years ago

AgitatedDove14 No, unless I close the window manually.

Disable the matplotlib GUI does work.

  
  
Posted 4 years ago

Ok, sorry, this is my mistake, it's actually inside a loop, so this make sense.

  
  
Posted 4 years ago

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")
  
  
Posted 4 years ago

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.

  
  
Posted 4 years ago

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')

  
  
Posted 4 years ago

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 ?

  
  
Posted 4 years ago

Hi EnviousStarfish54 ,
what version of server and SDK are you using?
can you report this experiment to demo server?

  
  
Posted 4 years ago
931 Views
30 Answers
4 years ago
one year ago
Tags