Skip to content

Commit 37dfed2

Browse files
committed
Added sample "with rgbimage" plot
1 parent 19a1275 commit 37dfed2

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

gnuplotlib.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -375,15 +375,21 @@ class gnuplotlib has a separate gnuplot process and a plot window. If multiple
375375
Also, note that while the DEFAULT tuplesize depends on whether we're making a 3D
376376
plot, once a tuplesize is given, the logic doesn't care if a 3D plot is being
377377
made. It can make sense to have a 2D implicit domain when making 2D plots. For
378-
example, one can be plotting a color map:
378+
example, one can be plotting a color map from an array of shape (H,W):
379379
380380
x,y = np.ogrid[-10:11,-10:11]
381381
gp.plot( x**2 + y**2,
382382
title = 'Heat map',
383-
set = 'view map',
384383
_with = 'image',
385384
tuplesize = 3)
386385
386+
Or a full-color image from an array of shape (H,W,3)
387+
388+
gp.plot( *nps.mv(image, -1,0),
389+
title = 'Full-color image',
390+
_with = 'rgbimage',
391+
tuplesize = 5)
392+
387393
Also note that the 'tuplesize' curve option is independent of implicit domains.
388394
This option specifies not how many data arrays we have, but how many values
389395
represent each data point. For example, if we want a 2D line plot with varying
@@ -1036,7 +1042,6 @@ class gnuplotlib has a separate gnuplot process and a plot window. If multiple
10361042
x,y = np.ogrid[-10:11,-10:11]
10371043
gp.plot( x**2 + y**2,
10381044
title = 'Heat map',
1039-
set = 'view map',
10401045
_with = 'image',
10411046
tuplesize = 3)
10421047

0 commit comments

Comments
 (0)