Re: [Matplotlib-users] Change color for fill_between to contour plot

2011-07-11 Thread Nader A

Thanks Ian... 
The tricontourf worked perfectly.   I was able to manipulate it further for
my needs, but your sample code saved me... 

Best regards, 
Nader Abedrabbo



Try tricontourf; I've attached an example.  Most of the example code is
manipulating your input data and calculating the connectivity of your grid.

I hope this helps,
Ian Thomas


-- 
View this message in context: 
http://old.nabble.com/Change-color-for-fill_between-to-contour-plot-tp32023678p32040130.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


--
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security 
threats, fraudulent activity, and more. Splunk takes this data and makes 
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2d-c2
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Change color for fill_between to contour plot

2011-07-09 Thread Ian Thomas
Try tricontourf; I've attached an example.  Most of the example code is
manipulating your input data and calculating the connectivity of your grid.

I hope this helps,
Ian Thomas
import matplotlib.pyplot as plt
import numpy as np

x,y1,y2,y3,y4,stress = np.loadtxt('data.txt', skiprows=2, delimiter=',', unpack=True)

# Arrays of all the point coordinates and stresses.
n = len(x)
x = np.hstack((x,x,x,x))
y = np.hstack((y1,y2,y3,y4))
stress = np.hstack((stress,stress,stress,stress))

# Triangle connectivity.
triangles = []
for i in range(n-1):
  triangles.append([i,i+1,n+i])
  triangles.append([i+1,n+i+1,n+i])
  triangles.append([2*n+i,2*n+i+1,3*n+i])
  triangles.append([2*n+i+1,3*n+i+1,3*n+i])

# Plot.
plt.tricontourf(x, y, triangles, stress)
plt.colorbar()
plt.show()
attachment: test.png--
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security 
threats, fraudulent activity, and more. Splunk takes this data and makes 
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2d-c2___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Change color for fill_between to contour plot

2011-07-08 Thread Nader A

Greetings, 

I am new to matplotlib. 
I have to plot a cross section of a cylinder and I want apply the stress in
the section to be a contour plot.  Similar to what you get from a Finite
Element Analysis data.  I have the data organized such that I can use
fill_between to create the basic plot and I use the a uniform color (red)
for now to fill between the lines.  The data organized is organized (see
attached 'data.txt' file) such that the fill_between is used as follows: 

http://old.nabble.com/file/p32023678/data.txt data.txt  

plt.fill_between(X, Y1, Y2,facecolor='red',alpha=alpha,linewidth=2)
plt.fill_between(X, Y3, Y4,facecolor='red',alpha=alpha,linewidth=2)

This produces a figure in this format: 

  http://old.nabble.com/file/p32023678/Uniform_Color.png 

What I want to do is instead of filling the color in red, i want to the
color to be a contour plot of the stress.  The stress values are shown in
the last column of the 'data.txt' file.   So, based on the stress values,
the fill in color should vary (say from blue for min(stress) values and red
for max(stress) values.  
 I was able to do a color extract for regions, but the colors are not
gradient and smooth as should be in stress contour plot.  
The example I was able to do is as follow: 

http://old.nabble.com/file/p32023678/Contour.png 


I appreciate any help on this matter. 

Thanks, 

-- 
View this message in context: 
http://old.nabble.com/Change-color-for-fill_between-to-contour-plot-tp32023678p32023678.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


--
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security 
threats, fraudulent activity, and more. Splunk takes this data and makes 
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2d-c2
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Change color for fill_between to contour plot

2011-07-08 Thread Paul Ivanov
Nader A, on 2011-07-08 20:22,  wrote:
 I am new to matplotlib. 

Welcome to the community!

 What I want to do is instead of filling the color in red, i want to the
 color to be a contour plot of the stress.  

I think contour and contourf will do what you want, see:
http://matplotlib.sourceforge.net/examples/pylab_examples/contour_image.html

best,
-- 
Paul Ivanov
314 address only used for lists,  off-list direct email at:
http://pirsquared.org | GPG/PGP key id: 0x0F3E28F7 


signature.asc
Description: Digital signature
--
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security 
threats, fraudulent activity, and more. Splunk takes this data and makes 
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2d-c2___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users