On 2010-12-08 17:57+0100 José Luis García Pallero wrote:

> Hello,
> I need to plot some information from C language and I have found
> PLplot. In GNU Octave and MatLab when I have a matrix of data
> representing an image I can plot it with the command 'imagesc()' and I
> can put a color scale in the plot with the command 'colorbar()'. Then
> I can export into a file via the 'print()' command. But now I need to
> do the same but from a C code. I have a C matrix (double** array)
> containing altitudes of points for a regular grid of x,y coordinates.
> Can I do the plot with PLplot and export the result as a *.png file?
> Can anyone show me any code for similar task? I have the data matrix
> (only one matrix, no red, blue, green components), but I want some
> coloured scale. Can I do that with PLplot? If PLplot can't do that,
> exists any C free software library to do?

Hi José:

Thank you for your interest in PLplot.

I suggest using -dev pngcairo (the png plot device based on the pango and
cairo libraries) or -dev pngqt (the png plot device based on the Qt4 set
of libraries) to obtain high-quality png results.  All results
at http://plplot.sourceforge.net/examples.php are done with -dev
pngcairo, but -dev pngqt is also of similar quality.

Any function of x and y can be plotted as false colour data using
plshades. See http://plplot.sourceforge.net/examples.php?demo=16 for
various examples of this for a variety of different functions. We also
have the capability to do this for randomly sampled data in the x, y
plane (see http://plplot.sourceforge.net/examples.php?demo=21). We
also have the ability to work with gray-scale (but not colour) images
using plimage, see http://plplot.sourceforge.net/examples.php?demo=20.
We also have the ability to plot on top of a fixed colour-image
background specified by the user for the qt and cairo device drivers.

Hez and I have just developed a discrete legend capability for PLplot
that allows users to plot legends consisting of annotated coloured
boxes, lines, and/or symbols.  (See preliminary results in
http://plplot.sourceforge.net/examples.php?demo=04).  I continued work
on pllegend after the last release and that work has now been
completed.  The full version of pllegend is available from the svn
trunk version of PLplot (and also will be available for the next
release). Hez is currently working on complementing that discrete
legend capability with a continuous (plcolorbar) legend capability.  The
plan is to have that done for the next release, but I don't know how
far he has progressed.

Of course, if your colorbar legend needs are really simple, it should
be straightforward for you to implement something quick and dirty with
plgradient that should be good enough until Hez completes his plcolorbar
work.

Alan
__________________________
Alan W. Irwin

Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).

Programming affiliations with the FreeEOS equation-of-state implementation
for stellar interiors (freeeos.sf.net); PLplot scientific plotting software
package (plplot.org); the libLASi project (unifont.org/lasi); the Loads of
Linux Links project (loll.sf.net); and the Linux Brochure Project
(lbproject.sf.net).
__________________________

Linux-powered Science
__________________________

------------------------------------------------------------------------------
This SF Dev2Dev email is sponsored by:

WikiLeaks The End of the Free Internet
http://p.sf.net/sfu/therealnews-com
_______________________________________________
Plplot-general mailing list
Plplot-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-general

Reply via email to