[Matplotlib-users] Possible regression in plotting lists of strings after 2.0

Douglas Clowes douglas.clowes at gmail.com
Thu Oct 25 01:08:09 EDT 2018


On Thu, Oct 25, 2018 at 2:19 PM Douglas Clowes <douglas.clowes at gmail.com>
wrote:

> I had a program that seemed to work fine on Fedora 27 (matplotlib 2.0.0)
> but exhibits strange behaviour on Fedora 29 (matplotlib 2.2.3) and Rawhide
> (matplotlib 3.0.0). Behaviour is the same with either python 2 or 3.
>
> The following "minimalist" program performs well where "y" is a list of
> floats and on 2.0.0 with either floats or strings. On later versions with
> strings:
> * it plots a straight line
> * has y-axis labels on every point
> * has linear spacing of non-linear points on y-axis
> * pressing "l" (lower-case L) yields a different scale and labels
>
> With read data (not monotonic) it yields even stranger results.
>
> Since it used to work, is it expected to work with strings or did I just
> get lucky?
>
> #!/usr/bin/env python3
> import csv
> import sys
> import matplotlib.pyplot as plt
>
> x = range(11)
> if "-s" in sys.argv:
>     y = [str(i*i) for i in x]
>     print("Strings")
> else:
>     y = [i*i for i in x]
>     print("Floats")
> plt.subplot(111)
> plt.grid(True)
> print("preplot")
> plt.plot(x, y, "+-")
> print("pretight")
> plt.tight_layout()
> print("presave")
> plt.savefig("plot.svg")
> print("preshow")
> plt.show()
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/matplotlib-users/attachments/20181025/68a88add/attachment.html>


More information about the Matplotlib-users mailing list