1

I'm using pylab. So is it using from show_graph import display ?

from pylab import *
from numpy import outer
from show_graph import display
rc('text', usetex=False)
a=outer(arange(0,1,0.01),ones(10))
figure(figsize=(10,5))
subplots_adjust(top=0.8,bottom=0.05,left=0.01,right=0.99)
maps=[m for m in cm.datad if not m.endswith("_r")]
maps.sort()
l=len(maps)+1
for i, m in enumerate(maps):
    subplot(1,l,i+1)
    axis("off")
    imshow(a,aspect='auto',cmap=get_cmap(m),origin="lower")
    title(m,rotation=90,fontsize=10)
savefig("colormaps.png",dpi=100,facecolor='gray')
display("colormaps.png")

But when I tried to run in, it says no module named show_graph

4
  • 1
    Where did you get the line from show_graph import display? Commented May 11, 2013 at 20:03
  • The third line.. Since I don't have any idea on how to display this graph Commented May 11, 2013 at 20:06
  • 1
    @ErikaSawajiri As far I know, there is no module named show_graph, other than if you have created a local one yourself. Therefore the interpreter will raise an ImportError when trying to import this module. Where have you seen the show_graph module used earlier? Commented May 11, 2013 at 20:15
  • I forgot where I saw it. So, is there any other way to display the graph? @nordev Commented May 11, 2013 at 20:17

1 Answer 1

1

You should remove the from show_graph import display, as this import raises an ImportError. Then your code to save and show the plot could e.g. be like this

from pylab import *
from numpy import outer
rc('text', usetex=False)
a=outer(arange(0,1,0.01),ones(10))
figure(figsize=(10,5))
subplots_adjust(top=0.8,bottom=0.05,left=0.01,right=0.99)
maps=[m for m in cm.datad if not m.endswith("_r")]
maps.sort()
l=len(maps)+1
for i, m in enumerate(maps):
    subplot(1,l,i+1)
    axis("off")
    imshow(a,aspect='auto',cmap=get_cmap(m),origin="lower")
    title(m,rotation=90,fontsize=10)
savefig("colormaps.png",dpi=100,facecolor='gray')
show()
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.