Skip to content
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

saving 3D line figure in pgf format results in error #3361

Closed
whymranderson opened this issue Aug 12, 2014 · 3 comments
Closed

saving 3D line figure in pgf format results in error #3361

whymranderson opened this issue Aug 12, 2014 · 3 comments

Comments

@whymranderson
Copy link

Python 2.7, NumPy 1.7.1, SciPy 0.13.0, Matplotlib 1.3.1

Really loves the Matplotlib! And the pgf backend support!

The following code works:

import matplotlib as mpl
mpl.use('pgf')
from matplotlib import pyplot
import mpl_toolkits.mplot3d.axes3d as p3

########
fig3 = pyplot.figure(3,figsize=(6, 6))
ax3 = p3.Axes3D(fig3)
ax3.view_init(elev=40, azim=5)
ax3.set_color_cycle('b')
########

test3, = ax3.plot([ 0.   ,       0.        ],
         [ 0.   ,       6.12372436],
         [ 0.   ,       3.53553391])
test3.set_linewidth(2)
pyplot.show()
pyplot.savefig(r'testlw.pgf')

but its cousin does not:

import matplotlib as mpl
mpl.use('pgf')
from matplotlib import pyplot
import mpl_toolkits.mplot3d.axes3d as p3

########
fig3 = pyplot.figure(3,figsize=(6, 6))
ax3 = p3.Axes3D(fig3)
ax3.view_init(elev=40, azim=5)
ax3.set_color_cycle('b')
########

test3, = ax3.plot([ 0.   ,       0.        ],
         [ 0.   ,       6.12372436],
         [ 0.   ,       3.53553391], linewidth='2')

pyplot.show()

pyplot.savefig(r'testlw.pgf')

The following error will come up:
lw = gc.get_linewidth() * mpl_pt_to_in * latex_in_to_pt
TypeError: can't multiply sequence by non-int of type 'float'

The only difference is the set linewidth method. Is it something I did wrong in the second code? Both codes plot correctly, but the second code fails to save into pgf file and generates errors mentioned above. Hope someone can help. Thanks in advance!

:) Tony

@WeatherGod
Copy link
Member

You passed it as a string instead of a numerical value.

Cheers
Ben Root
On Aug 11, 2014 11:13 PM, "whymranderson" notifications@github.com wrote:

Python 2.7, NumPy 1.7.1, SciPy 0.13.0, Matplotlib 1.3.1

Really loves the Matplotlib! And the pgf backend support!

The following code works:

import matplotlib as mpl
mpl.use('pgf')
from matplotlib import pyplot
import mpl_toolkits.mplot3d.axes3d as p3

########
fig3 = pyplot.figure(3,figsize=(6, 6))
ax3 = p3.Axes3D(fig3)
ax3.view_init(elev=40, azim=5)
ax3.set_color_cycle('b')
########

test3, = ax3.plot([ 0. , 0. ],
[ 0. , 6.12372436],
[ 0. , 3.53553391])
test3.set_linewidth(2)
pyplot.show()
pyplot.savefig(r'testlw.pgf')

but its cousin does not:

import matplotlib as mpl
mpl.use('pgf')
from matplotlib import pyplot
import mpl_toolkits.mplot3d.axes3d as p3

########
fig3 = pyplot.figure(3,figsize=(6, 6))
ax3 = p3.Axes3D(fig3)
ax3.view_init(elev=40, azim=5)
ax3.set_color_cycle('b')
########

test3, = ax3.plot([ 0. , 0. ],
[ 0. , 6.12372436],
[ 0. , 3.53553391], linewidth='2')

pyplot.show()

pyplot.savefig(r'testlw.pgf')

The following error will come up:
lw = gc.get_linewidth() * mpl_pt_to_in * latex_in_to_pt
TypeError: can't multiply sequence by non-int of type 'float'

The only difference is the set linewidth method. Is it something I did
wrong in the second code? Hope someone can help. Thanks in advance!

:) Tony


Reply to this email directly or view it on GitHub
#3361.

@whymranderson
Copy link
Author

Wow that is embarrassing, as my first question at github. Many thanks still!

@WeatherGod
Copy link
Member

You wouldn't believe how often that particular "bug" came up after the
introduction of the pgf backend... no problem, and keep the questions
coming!

On Mon, Aug 11, 2014 at 11:28 PM, whymranderson notifications@github.com
wrote:

Wow that is embarrassing, as my first question at github. Many thanks
still!


Reply to this email directly or view it on GitHub
#3361 (comment)
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants