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
Hi All! I Am Logging A Plot And I Am Having An Issue With Its Legend. When I Run The Code Myself It Appears As Expected (1St Image). When I Log It In Clearml The Legend Is Not Right (2Nd Image). The Code For Generating The Plot Is (Df Is A Pandas Datafram

Hi all!
I am logging a plot and I am having an issue with its legend. When I run the code myself it appears as expected (1st image). When I log it in ClearML the legend is not right (2nd image).
The code for generating the plot is (df is a pandas dataframe that has columns step, Agent, Target, Prior):

grouped_df = df.groupby("step")
plt.figure(figsize=(10, 6))

for label, color, marker in zip(["Agent", "Prior", "Target"], ['b', 'r', 'g'], ['o', 's', '^']):
    if label in df.columns:
        means = grouped_df[label].mean()
        X = means.index.values
        Y = means.values
        plt.scatter(X, Y, label=label, color=color, marker=marker) 

# Add labels, legend, and title
plt.xlabel("step")
plt.ylabel("NLL")
plt.title("NLLs")
plt.legend(title="Legend")

# Log the figure with ClearML
fig = plt.gcf()  # Get the current figure
logger.report_matplotlib_figure(
    title='NLLs', series='NLLs', figure=fig, iteration=0
)

Any ideas of what is the issue and how it can be solved? Many thanks for any help!
image
image

  
  
Posted one month ago
Votes Newest

Answers 5


Yeah SmallTurkey79 is right, reverting to image is the safest way to get exactly the same...
btw, BrightDog7 if you can produce a standalone example of reporting the data, we can probably fix whatever is broken in the auto convert, or at least revert to image based automatically (basically if the plot is simple enough it will try to convert it, otherwise it will automatically revert to image internally)

  
  
Posted one month ago

thank you both, I’ll try to provide you with a standalone example in the coming days!

  
  
Posted one month ago

Hi AgitatedDove14 , many thanks for the answer! The data is not the same between the two plots, hence the change of the proportion. The issue is with the legend. When logged in clearML it does not appear properly, all points are labelled as “NNLs”

  
  
Posted one month ago

Hi BrightDog7
Seems like mostly proportion change, the data is the same but the layout on the web is wider hence the change (btw you can download the data from the web UI as json to double check)
Notice that it tries to convert it to "interactive" data points for easier zooming etc, and that's probably the cause of the proportion change.
You can force an image (like what you get directly from matplotlib):

logger.report_matplotlib_figure(
    title='NLLs', series='NLLs', figure=fig, iteration=0
    report_interactive=False,
)
  
  
Posted one month ago

id try the static image approach if you dont care about interactivity,

or for more control, switch to plotly and report_plotly for better consistency .

i've not had the best luck with the automated conversion on complex plots before . and when its sufficiently large it doesn't even show up in preview .

static images are in my opinion the most reliable, if not limited by your choice of resolution when you create the figure

  
  
Posted one month ago
216 Views
5 Answers
one month ago
one month ago
Tags