On 10/02/2020 18:43, Aaron Meurer wrote:
SymPy also comes with Anaconda. Anaconda basically installs a
completely separate Python installation, but as long as the same
installation includes SymPy and matplotlib they will be able to work
with each other.

The issue is that things like tkinter or qt that are needed for
matplotlib plotting are not Python packages but rather C libraries, so
pip cannot install them. The conda package manager that comes with
Anaconda is much better at installing those things, especially on
Windows. I would also suggest using conda-forge, which includes even
more packages.

I would also mention that if you don't care about interaction, the
easiest way to use matplotlib is in the Jupyter notebook with
'%matplotlib inline'.

On 10/02/2020 18:43, Aaron Meurer wrote:
SymPy also comes with Anaconda. Anaconda basically installs a
completely separate Python installation, but as long as the same
installation includes SymPy and matplotlib they will be able to work
with each other.

The issue is that things like tkinter or qt that are needed for
matplotlib plotting are not Python packages but rather C libraries, so
pip cannot install them. The conda package manager that comes with
Anaconda is much better at installing those things, especially on
Windows. I would also suggest using conda-forge, which includes even
more packages.

I would also mention that if you don't care about interaction, the
easiest way to use matplotlib is in the Jupyter notebook with
'%matplotlib inline'.

Thanks Aaron, but I took a look at Anaconda, hoping that it was a better version of pip, but it is a huge sprawling package weighing in at almost 1 Gigabyte of storage - even in its compressed form. It seems to want to take over my entire python experience. I'd really like to know how SymPy manages to use Matplotlib to create plots, which it does correctly usingĀ  my current python setup, and which would presumably solve the problem.

I have already tried executing matplotlib.use("Qt5Agg"), which Oscar recommended some time back and which got SymPy plots working nicely under 64-bit Windows 10.

I chose to test a very simple test program from the Matplotlib examples:

import  matplotlib
import  matplotlib.pyplot  as  plt
import  numpy  as  np

# Data for plotting
t  
<https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray>
  =  np.arange  
<https://docs.scipy.org/doc/numpy/reference/generated/numpy.arange.html#numpy.arange>(0.0,
  2.0,  0.01)
s  <https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray>  =  1  
+  np.sin  <https://docs.scipy.org/doc/numpy/reference/generated/numpy.sin.html#numpy.sin>(2  *  
np.pi  <https://docs.scipy.org/doc/numpy/reference/constants.html#numpy.pi>  *  t  
<https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray>)

fig  
<https://matplotlib.org/3.1.3/api/_as_gen/matplotlib.figure.Figure.html#matplotlib.figure.Figure>,
  ax  
<https://matplotlib.org/3.1.3/api/_as_gen/matplotlib.axes.SubplotBase.html#matplotlib.axes.SubplotBase>
  =  plt.subplots  
<https://matplotlib.org/3.1.3/api/_as_gen/matplotlib.pyplot.subplots.html#matplotlib.pyplot.subplots>()
ax  
<https://matplotlib.org/3.1.3/api/_as_gen/matplotlib.axes.SubplotBase.html#matplotlib.axes.SubplotBase>.plot(t
  <https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray>,  
s  <https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray>)

ax  
<https://matplotlib.org/3.1.3/api/_as_gen/matplotlib.axes.SubplotBase.html#matplotlib.axes.SubplotBase>.set(xlabel='time
 (s)',  ylabel='voltage (mV)',
       title='About as simple as it gets, folks')
ax  
<https://matplotlib.org/3.1.3/api/_as_gen/matplotlib.axes.SubplotBase.html#matplotlib.axes.SubplotBase>.grid()

fig  
<https://matplotlib.org/3.1.3/api/_as_gen/matplotlib.figure.Figure.html#matplotlib.figure.Figure>.savefig("test.png")
plt.show  
<https://matplotlib.org/3.1.3/api/_as_gen/matplotlib.pyplot.show.html#matplotlib.pyplot.show>()

Best wishes,

David

--
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sympy+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/92ad4b45-be3d-2a35-8ba1-846f6aa072d7%40dbailey.co.uk.

Reply via email to