I am trying to reproduce the code given on https://blog.stata.com/2020/09/14/st...l-predictions/
I was desperate not to find a way to use the interactive backend and eventually chose to use matplotlib.use('agg') instruction to get a graph at the end. But still, I have another problem. The following code
Code:
python: import pandas as pd data = pd.read_stata("predictions.dta") import numpy as np mylist = np.arange(20,90,step=10) import matplotlib matplotlib.use('agg') import matplotlib.pyplot as plt data = pd.read_stata("predictions.dta") ax = plt.axes(projection='3d') plt.savefig("essai.png") end
Traceback (most recent call last):
File "/Users/alexispe/opt/anaconda3/lib/python3.7/site-packages/matplotlib/projections/__init__.py", line 58, in g
> et_projection_class
return projection_registry.get_projection_class(projectio n)
File "/Users/alexispe/opt/anaconda3/lib/python3.7/site-packages/matplotlib/projections/__init__.py", line 25, in g
> et_projection_class
return self._all_projection_types[name]
KeyError: '3d'
Is there any clue to help me? I use Stata 16 with Mac OS X and an Anaconda Python setup (I have other Python versions installed if needed).
At first, I thought that Python integration within Stata could an open window on a different (and perhaps better?) world that could threaten Stata but now I start to realise how smart the move is: it makes Stata users understand how easy, convenient and readable Stata language is!
0 Response to Failing to properly reproduce Stata Blog's examples with Matplotlib
Post a Comment