New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"float() argument must be a string or a number" when saving a png #2658
Comments
I don't understand; it is an error. Linewidth is a scalar, but you are feeding it a list. The odd thing is that pdf does not raise an exception. |
So, something like this is not possible in matplotlib: http://docs.ggplot2.org/current/geom_line-22.png (from http://docs.ggplot2.org/current/geom_line.html -> forth image from bottom) I only found this: http://stackoverflow.com/questions/19390895/matplotlib-plot-with-variable-line-width which suggest adding multiple lines for each part. x = [1, 2, 3, 4, 5]
y = [5, 4, 3, 2, 1]
width = [.5, 1, 4.5, 1.75, 1.75]
for i in range(len(x)-1):
plt.plot(x[i:i+2], y[i:i+2], linewidth=width[i])
plt.show() -> doesn't look really good as the lines overlap and have steps in between the values. |
Correct, mpl does not have a variable line width plotting method. |
Currently, matplotlib does not allow for different sizes of one line (see matplotlib/matplotlib#2658) so adding a size mapping will not work (and produces an error on png devices and does nothing on pdf devices). Add a workaround in geom_line to detect such cases, print a warning and set the size to a hardcoded value of "4" (can be changed by '+ geom_line(size=x)'. Also add updated baseline images for the corresponding tests.
Other than using a LineCollection, which does not have the same interface as |
Currently, matplotlib does not allow for different sizes of one line (see matplotlib/matplotlib#2658) so adding a size mapping will not work (and produces an error on png devices and does nothing on pdf devices). Add a workaround in geom_line to detect such cases, print a warning and set the size to a hardcoded value of "4" (can be changed by '+ geom_line(size=x)'. Also add updated baseline images for the corresponding tests.
This throws an error with the png backend (save as pdf works):
The text was updated successfully, but these errors were encountered: