I have figured out how to generate data that can be fed to Gnuplot by
myself. It should be an array of [row, col, val].
So, here is what I did:
import Gnuplot
from numpy import *
g = Gnuplot.Gnuplot(persist=True)
C = zeros((11,11), 'f')
C[5,5] = 1.0
nrow, ncol = C.shape
dg = [[i,j,C[i,j]] for i in range(nrow) for j in range(ncol)] # data
for gnuplot
d = Gnuplot.Data(e, with_='image')
g.plot(d)
On Apr 29, 2009, at 15:09 , Wonseok Shin wrote:
> So I have:
> >> from numpy import zeros
> >> C = zeros((11,11),'f')
> >> C[5,5] = 1.0
>
> Then how can I plot this array with "plot ... with image"?
> What is the way to convert C into a type of data that can be fed
> into the gnuplot command "plot ... with image"?
>
> - Wonseok
>
>
> On Apr 29, 2009, at 0:37 , Benny Malengier wrote:
>
>>
>>
>> 2009/4/29 Wonseok Shin <ws...@st...>
>> Hello,
>>
>> Is there some way to use a gnuplot command "plot ... with image"?
>> This is a relatively new feature in gnuplot version 4.2 to draw a 2D
>> image, and probably by that reason I cannot easily find a good
>> example
>> of its usage in gnuplot.py.
>>
>> Specifically, I want to to draw 2D NumPy array C[i, j] with "plot ...
>> with image".
>>
>> Newer commands are not directly available in gnuplot.py, but you
>> can send normal gnuplot commands to do everything gnuplot can handle.
>>
>> Benny
>>
>
> ------------------------------------------------------------------------------
> Register Now & Save for Velocity, the Web Performance & Operations
> Conference from O'Reilly Media. Velocity features a full day of
> expert-led, hands-on workshops and two days of sessions from industry
> leaders in dedicated Performance & Operations tracks. Use code
> vel09scf
> and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf_______________________________________________
> Gnuplot-py-users mailing list
> Gnu...@li...
> https://lists.sourceforge.net/lists/listinfo/gnuplot-py-users
|