Skip to content

Commit

Permalink
Add xlabel to PlotElement.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 643071878
  • Loading branch information
qiuyiz authored and Copybara-Service committed Jun 13, 2024
1 parent 7d069fc commit 6d558d4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion vizier/_src/benchmarks/analyzers/plot_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,6 @@ def _metadata_to_str(metadata: vz.Metadata) -> str:
percentiles=(elem_for_metric.percentile_error_bar,),
**kwargs,
)
ax.set_xlabel('# of Trials')
elif plot_type == 'scatter':
plot = elem_for_metric.plot_array
ax.scatter(
Expand Down Expand Up @@ -254,6 +253,7 @@ def _metadata_to_str(metadata: vz.Metadata) -> str:
)
else:
raise ValueError(f'{plot_type} plot not yet supported!')
ax.set_xlabel(elem_for_metric.xlabel)
ax.set_yscale(elem_for_metric.yscale)
ax.yaxis.set_major_locator(mpl.ticker.LinearLocator(20))
ax.yaxis.set_minor_locator(mpl.ticker.LinearLocator(100))
Expand Down
3 changes: 3 additions & 0 deletions vizier/_src/benchmarks/analyzers/state_analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ class PlotElement:
default='error-bar',
validator=attrs.validators.in_(['error-bar', 'histogram', 'scatter']),
)
xlabel: str = attrs.field(
default='Num Trials', validator=attrs.validators.instance_of(str)
)
yscale: str = attrs.field(
default='linear',
validator=attrs.validators.in_(['linear', 'symlog', 'logit']),
Expand Down

0 comments on commit 6d558d4

Please sign in to comment.