2 Replies - 170 Views - Last Post: 10 October 2018 - 11:26 AM Rate Topic: -----

#1 esadri21   User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 80
  • Joined: 09-November 17

plt.show() does not work

Posted 09 October 2018 - 04:40 PM

The following code is a tutoorial from this page
What should be added at the end of this code to display the plots?
I tried plt.show() but did not work.

thank you

from __future__ import print_function
import sys, os
sys.path.insert(0,os.path.realpath(os.path.join(os.getcwd(),'..')))
from getdist import plots, MCSamples
import getdist, IPython
import pylab as plt
print('GetDist Version: %s, Matplotlib version: %s'%(getdist.__version__, plt.matplotlib.__version__))
#matplotlib 2 doesn't seem to work well without usetex on
plt.rcParams['text.usetex']=True
import numpy as np
ndim = 4
nsamp = 10000
np.random.seed(10)
A = np.random.rand(ndim,ndim)
cov = np.dot(A, A.T)
samps = np.random.multivariate_normal([0]*ndim, cov, size=nsamp)
A = np.random.rand(ndim,ndim)
cov = np.dot(A, A.T)
samps2 = np.random.multivariate_normal([0]*ndim, cov, size=nsamp)
names = ["x%s"%i for i in range(ndim)]
labels =  ["x_%s"%i for i in range(ndim)]
samples = MCSamples(samples=samps,names = names, labels = labels)
samples2 = MCSamples(samples=samps2,names = names, labels = labels, label='Second set')
g = plots.getSubplotPlotter()
g.triangle_plot([samples, samples2], filled=True)



Is This A Good Question/Topic? 0
  • +

Replies To: plt.show() does not work

#2 Cup of Java   User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 44
  • Joined: 26-September 13

Re: plt.show() does not work

Posted 10 October 2018 - 08:26 AM

Why are you not importing matplotlib? You have the print line for the version, but never import it.
Was This Post Helpful? 0
  • +
  • -

#3 esadri21   User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 80
  • Joined: 09-November 17

Re: plt.show() does not work

Posted 10 October 2018 - 11:26 AM

Doing that does not solve anything. ALSO, I am doing what the tutorial is saying.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1