<div dir="ltr">This is an intentional change to support categorical string-data (see <a href="https://matplotlib.org/gallery/lines_bars_and_markers/categorical_variables.html">https://matplotlib.org/gallery/lines_bars_and_markers/categorical_variables.html</a>) in 2.1.<div><br></div><div>Plotting a list of strings that happened to be floats worked <2.1 by chance because there was a `np.asarray(data)` someplace which worked because numpy implicitly did the conversion.   You are not the only person to hit this, we miss-estimated how used this accidental feature was, sorry.</div><div><br></div><div>The most reliable path is to convert your data to numeric types before handing it to Matplotlib (this will be guaranteed to work on all past and future versions of Matplotlib!).</div><div><br></div><div>Tom</div></div><br><div class="gmail_quote"><div dir="ltr">On Thu, Oct 25, 2018 at 1:08 AM Douglas Clowes <<a href="mailto:douglas.clowes@gmail.com">douglas.clowes@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr">On Thu, Oct 25, 2018 at 2:19 PM Douglas Clowes <<a href="mailto:douglas.clowes@gmail.com" target="_blank">douglas.clowes@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div dir="ltr"><div>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.</div><div><br></div><div>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:</div><div>* it plots a straight line</div><div>* has y-axis labels on every point</div><div>* has linear spacing of non-linear points on y-axis</div><div>* pressing "l" (lower-case L) yields a different scale and labels</div><div><br></div><div>With read data (not monotonic) it yields even stranger results.</div><div><br></div><div>Since it used to work, is it expected to work with strings or did I just get lucky?</div><div><br></div>#!/usr/bin/env python3<br>import csv<br>import sys<br>import matplotlib.pyplot as plt<br><br>x = range(11)<br>if "-s" in sys.argv:<br>    y = [str(i*i) for i in x]<br>    print("Strings")<br>else:<br>    y = [i*i for i in x]<br>    print("Floats")<br>plt.subplot(111)<br>plt.grid(True)<br>print("preplot")<br>plt.plot(x, y, "+-")<br>print("pretight")<br>plt.tight_layout()<br>print("presave")<br>plt.savefig("plot.svg")<br>print("preshow")<br>plt.show()<br></div></div>
</blockquote></div>
_______________________________________________<br>
Matplotlib-users mailing list<br>
<a href="mailto:Matplotlib-users@python.org" target="_blank">Matplotlib-users@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/matplotlib-users" rel="noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/matplotlib-users</a><br>
</blockquote></div>