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

3D plots #119

Open
whllnd opened this issue Oct 9, 2016 · 6 comments
Open

3D plots #119

whllnd opened this issue Oct 9, 2016 · 6 comments

Comments

@whllnd
Copy link

whllnd commented Oct 9, 2016

Hi,

trying to plot in 3D gives an error:

import numpy as np
import matplotlib.pyplot as plt
import mpl_toolkits.mplot3d
import matplotlib2tikz as tikz
pos = np.zeros((3,10))
pos[0] = np.arange(10)
ax = plt.gca(projection="3d")
ax.scatter(pos[0], pos[1], pos[2], c=np.arange(pos.shape[1]))
tikz.save("pos.tex")

results in

file encoding: UTF-8
Traceback (most recent call last):
  File "makePlots.py", line 128, in <module>
    tikz.save("../thesis/plots/pos1.tex")
  File "/home/per/.miniconda3/lib/python3.5/site-packages/matplotlib2tikz/save.py", line 146, in save
    data, content = _recurse(data, figure)
  File "/home/per/.miniconda3/lib/python3.5/site-packages/matplotlib2tikz/save.py", line 223, in _recurse
    ax = axes.Axes(data, child)
  File "/home/per/.miniconda3/lib/python3.5/site-packages/matplotlib2tikz/axes.py", line 149, in __init__
    assert yaxis_pos == 'right'
AssertionError

Is 3D plotting supported at all, or do I have to venture further? Great work, though, 2D plots are a real treat with this one!

EDIT: Forgot to say using version 0.5.14

@nschloe
Copy link
Owner

nschloe commented Oct 9, 2016

Should definitely; I'll look at it later.

@nschloe
Copy link
Owner

nschloe commented Oct 9, 2016

This is a matplotlib issue; see matplotlib/matplotlib#7243. If you want this to work, +1 there.

@svretina
Copy link

svretina commented Dec 8, 2018

is this error solved? I get the same error message when trying to save a 3d plot

Traceback (most recent `all last):
  File "./surface_fit.py", line 472, in <module>
    tikz.save("./figures/surface.tex")
  File "/usr/local/lib/python3.6/site-packages/matplotlib2tikz/save.py", line 197, in save
    code = get_tikz_code(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/matplotlib2tikz/save.py", line 160, in get_tikz_code
    data, content = _recurse(data, figure)
  File "/usr/local/lib/python3.6/site-packages/matplotlib2tikz/save.py", line 280, in _recurse
    ax = axes.Axes(data, child)
  File "/usr/local/lib/python3.6/site-packages/matplotlib2tikz/axes.py", line 150, in __init__
    assert yaxis_pos == 'right'
AssertionError

Repository owner deleted a comment from TKaluza Mar 13, 2019
Repository owner deleted a comment from DF3AK Mar 13, 2019
@nschloe
Copy link
Owner

nschloe commented Mar 13, 2019

@svretina Not solved, it's a matplotlib issue. See above.

@AlexSchwabauer
Copy link

@nschloe the latest reply in the issue that you linked suggests using the property _offsets3d. Is this something this library can do as long there is no official answer?
Here's the link to the reply: matplotlib/matplotlib#7243 (comment)

@nschloe
Copy link
Owner

nschloe commented Mar 11, 2020

Sure, whatever works.

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

4 participants