[Matplotlib-users] pyplot.contour() and filtered levels

At the switch to MPL 2.2 (from 1.5 i think), my calls to
pyplot.clabel() started throwing ValueError. This turned out to be
because the pyplot.contour() returned a ContourSet which had filtered
out the levels that were not displayed in the area of the data i am
trying to plot. As i build my list of level labels for the list of
levels that i pass to contour(), that list could contain levels that
had been filtered out by contour(), which throws a ValueError in
clabel(). so i also filtered my list of levels to label based on the
levels kept by the CountourSet.

Now, i get the impression that there is a similar issue for the
optional lists of line width, style, and color that we pass to
pyplot.contour.
If i move/zoom in a specific area of my data to draw isolines on it,
with the same python code everytime, that uses the same list of levels
based on the data of the whole area, and not levels based on the data
on the drawn area, depending on the area/zoom, the lines styles seem
to be shifted. As if levels were filtered out, but not the related
items of the other arrays, so styles apply to a different level.

Does someone have a hint about what's actually going on and how i
might work around it, or, if i'm lucky, if a version more recent than
2.2.3 fixes this issue?

···

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@python.org
https://mail.python.org/mailman/listinfo/matplotlib-users

I did another test, with the same code but by passing to matplotlib
only the levels that are in the drawn area. My problem of line style
shift disappears.
Is it expected that when contour() filters level it will not filter
the same lines of linewidths, linestyles, and colors? Because they
are not always the same number as the levels maybe? Or should this be
considered a bug, at least for the case when the arrays have the same
number of elements than levels? Could the documentation mention at
least a warning about it?

···

Le mar. 24 sept. 2019 à 14:15, Olivier B. <perso.olivier.barthelemy@gmail.com> a écrit :

At the switch to MPL 2.2 (from 1.5 i think), my calls to
pyplot.clabel() started throwing ValueError. This turned out to be
because the pyplot.contour() returned a ContourSet which had filtered
out the levels that were not displayed in the area of the data i am
trying to plot. As i build my list of level labels for the list of
levels that i pass to contour(), that list could contain levels that
had been filtered out by contour(), which throws a ValueError in
clabel(). so i also filtered my list of levels to label based on the
levels kept by the CountourSet.

Now, i get the impression that there is a similar issue for the
optional lists of line width, style, and color that we pass to
pyplot.contour.
If i move/zoom in a specific area of my data to draw isolines on it,
with the same python code everytime, that uses the same list of levels
based on the data of the whole area, and not levels based on the data
on the drawn area, depending on the area/zoom, the lines styles seem
to be shifted. As if levels were filtered out, but not the related
items of the other arrays, so styles apply to a different level.

Does someone have a hint about what's actually going on and how i
might work around it, or, if i'm lucky, if a version more recent than
2.2.3 fixes this issue?

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@python.org
https://mail.python.org/mailman/listinfo/matplotlib-users

Olivier,

I think this has been fixed, and the filtering is no longer done. Would you try the current release, please?

Eric

···

On 2019/09/24 4:17 AM, Olivier B. wrote:

I did another test, with the same code but by passing to matplotlib
only the levels that are in the drawn area. My problem of line style
shift disappears.
Is it expected that when contour() filters level it will not filter
the same lines of linewidths, linestyles, and colors? Because they
are not always the same number as the levels maybe? Or should this be
considered a bug, at least for the case when the arrays have the same
number of elements than levels? Could the documentation mention at
least a warning about it?

Le mar. 24 sept. 2019 à 14:15, Olivier B. > <perso.olivier.barthelemy@gmail.com> a écrit :

At the switch to MPL 2.2 (from 1.5 i think), my calls to
pyplot.clabel() started throwing ValueError. This turned out to be
because the pyplot.contour() returned a ContourSet which had filtered
out the levels that were not displayed in the area of the data i am
trying to plot. As i build my list of level labels for the list of
levels that i pass to contour(), that list could contain levels that
had been filtered out by contour(), which throws a ValueError in
clabel(). so i also filtered my list of levels to label based on the
levels kept by the CountourSet.

Now, i get the impression that there is a similar issue for the
optional lists of line width, style, and color that we pass to
pyplot.contour.
If i move/zoom in a specific area of my data to draw isolines on it,
with the same python code everytime, that uses the same list of levels
based on the data of the whole area, and not levels based on the data
on the drawn area, depending on the area/zoom, the lines styles seem
to be shifted. As if levels were filtered out, but not the related
items of the other arrays, so styles apply to a different level.

Does someone have a hint about what's actually going on and how i
might work around it, or, if i'm lucky, if a version more recent than
2.2.3 fixes this issue?

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@python.org
https://mail.python.org/mailman/listinfo/matplotlib-users

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@python.org
https://mail.python.org/mailman/listinfo/matplotlib-users