atcollab / at

Accelerator Toolbox
Apache License 2.0
48 stars 31 forks source link

synoptics not visible in atplot when vertical values are above zero #722

Closed oscarxblanco closed 4 months ago

oscarxblanco commented 6 months ago

Dear all,

there is a minor bug when plotting the synoptics using atplot.m because the vertical axis limits are not checked.

By default the synoptics flag is true and the lattice synoptics is plotted at zero in the vertical axis, but, depending on the optics the vertical values might not be close to zero and the height of the blocks is not high enough, leaving the synoptics out of the plot. For example, image

One easy fix could be the following. Change this https://github.com/atcollab/at/blob/abc7aebaaf763614fff7a5c68a9d190285b9a62a/atmat/atplot/xplot.m#L67-L69

to this, or something similar :

if synopt
    if ax.YLim(1) > 0, ax.YLim(1) = 0; end % change YLim to see synopt
    curve.lattice=atplotsyn(ax,ring,varargs{:});  % Plot lattice elements
end

image In the last image the synoptics is visible even if the grid is only around the plotted values.

lfarv commented 4 months ago

fixed in #726