Friends,
I have solved the problem by myself. I  gave
if w < 2.0: color = 'red'
if 2.1 < w > 4.0: color='blue' So wherever the value there is a value like
2.03 or 2.05, the color was shown as black instead of red/blue.

Thanks,
Bala

On Mon, Sep 26, 2011 at 9:25 AM, Bala subramanian <bala.biophys...@gmail.com
> wrote:

> Friends,
> In the mpl site, i found the an example code called hinton_demo to plot
> weighted matrix in the following link.
>
>
> http://matplotlib.sourceforge.net/examples/api/hinton_demo.html?highlight=hinton
>
> I used the same script (attached test.py) making a slight modification in
> the following section of the code pasted below. I just included more color
> range and modified the size as np.sqrt(np.abs(w))/5.
>
> However when i run the script with test data (attached test.dat), i found
> that the size of the square and color are not matching. For instance the
> size of the squares at position 4,3 and 7,6 are small but the color (black)
> is not relevant to the size. I am not getting what is going wrong. Kindly
> help to resolve the problem.
>
> The script and test data are attached.
>
> *Section of the code modified*
>
> for (x,y),w in np.ndenumerate(W):
>         if w > 0: color = 'white'
>         else:     color = 'black'
>         size = np.sqrt(np.abs(w))
>         rect = Rectangle([x - size / 2, y - size / 2], size, size,
>             facecolor=color, edgecolor=color)
>         ax.add_patch(rect)
>
>
------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2dcopy1
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to