Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>It depends what you need to do with the graph once you have it, <a href="http://matplotlib.sourceforge.net/index.html" rel="nofollow noreferrer">Matplotlib</a> allows you to interactively show the graph on the screen, save it in either vector, pdf or bitmap format, and more.</p> <p>If you opt for this framework, <code>imshow</code> will do what you need, here is an example:</p> <pre><code># Just some data to test: from random import gauss a = [[gauss(0, 10) for i in xrange(0, 5)] for j in xrange(0,5)] from pylab import * # or just launch "IPython -pylab" from the command line # We create a custom colormap: myblue = cm.colors.LinearSegmentedColormap("myblue", { 'red': [(0, 1, 1), (1, 0, 0)], 'green': [(0, 1, 1), (1, 0, 0)], 'blue': [(0, 1, 1), (1, 1, 1)]}) # Plotting the graph: imshow(a, cmap=myblue) </code></pre> <p>For further details on the colormap <a href="http://matplotlib.sourceforge.net/api/colors_api.html?highlight=linearsegmentedcolormap#matplotlib.colors.LinearSegmentedColormap" rel="nofollow noreferrer">check this link</a>, and here is the <a href="http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.imshow" rel="nofollow noreferrer">link for imshow</a> - or simply use <code>help(colors.LinearSegmentedColormap)</code> and <code>help(imshow)</code>.</p> <p><a href="http://img522.imageshack.us/img522/6230/bluep.png" rel="nofollow noreferrer">alt text http://img522.imageshack.us/img522/6230/bluep.png</a></p> <p>(note that this is the result with the standard options, you can add a grid, change the filtering and so on).</p> <hr> <p><strong>Edit</strong></p> <blockquote> <p>however I'm looking to display the numbers in the grid</p> </blockquote> <p>To keep it simple:</p> <pre><code>for i in xrange(0,5): for j in xrange(0,5): text(i, j, "{0:5.2f}".format(a[i][j]), horizontalalignment="center", verticalalignment="center") </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload