LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 03-14-2009, 11:56 AM   #1
DeepSeaNautilus
Member
 
Registered: Jul 2008
Posts: 65

Rep: Reputation: 15
creating graphics from file


Hello, is there an application that can read a file with x-y values and then create a graphic as a jpg 2d image (or other image format) as output?
The file would be like this:
Code:
Person - Posts
Michael - 5
John - 10
Robin - 15
Thanks in advance.
 
Old 03-14-2009, 12:18 PM   #2
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Arch + Xfce
Posts: 6,852

Rep: Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037
I think you need to define your desired output a bit more clearly. I really don't understand what you want at this point. By "graphic" do you mean a graph? What kind of graph? How should the data be displayed?
 
Old 03-14-2009, 12:31 PM   #3
jlinkels
LQ Guru
 
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195

Rep: Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043
Gnuplot

jlinkels
 
Old 03-14-2009, 12:43 PM   #4
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
A spreadsheet program typically has plotting capabilities----something like OpenOffice calc will open most ordered files.
 
Old 03-14-2009, 02:12 PM   #5
DeepSeaNautilus
Member
 
Registered: Jul 2008
Posts: 65

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by David the H. View Post
I think you need to define your desired output a bit more clearly. I really don't understand what you want at this point. By "graphic" do you mean a graph? What kind of graph? How should the data be displayed?
The output I want is a bar chart jpg image. I am looking for a console application so I can create the bar charts using a bash script. The data should be displayed, in the x axis, the names of the persons and in the y axis, the number of posts they have made. This is only an example, the real files have much more data and it will be a really tedious thing to do it manually using open office. I want to make bar charts similar to those you would get by creating the bar charts in open office´s calc, then taking a screen shoots from them and saving them with jpg format. The thing is that I don't want to do this process manually, but automatically using a bash script.
 
Old 03-14-2009, 02:16 PM   #6
DeepSeaNautilus
Member
 
Registered: Jul 2008
Posts: 65

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by pixellany View Post
A spreadsheet program typically has plotting capabilities----something like OpenOffice calc will open most ordered files.
I know, but is there any way I can use OpenOffice calc or any other program in a bash script to create several bar charts automatically by giving them the files with the information required?
 
Old 03-14-2009, 02:39 PM   #7
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
You can use gnuplot to produce a bar graph & use the jpeg output driver. You may want to produce a file containing the data in a form gnu plot expects, write a gnuplot script that will use this datafile and create the jpeg graph, and then call: gnuplot <your_gnu_plot_script>.
From the info file:
Code:
   Examples:

   To plot a data file with solid filled boxes with a small vertical
space separating them (bargraph):

           set boxwidth 0.9 relative
           set style fill solid 1.0
           plot 'file.dat' with boxes
Also use locate to locate the html and/or pdf documentation for gnuplot.

Other options could be using postscript or latex graphic commands. There is a gnuplottex version of latex, but I don't know if you can produce jpeg files from the results.

There is also the plotutils package including the plot command. They can produce ps, png or psuedo-gif files as output which you could convert easily to jpeg.

From the plot info manual:
Code:
To produce a PNG file, you would do
     plot -T png < test.meta > test.png
If you will be using these plots for a college paper, you may want to use an eps output filter instead of png. LaTeX works better importing eps graphics. ( pdftex may be different )

Last edited by jschiwal; 03-14-2009 at 02:42 PM.
 
Old 03-14-2009, 02:42 PM   #8
DeepSeaNautilus
Member
 
Registered: Jul 2008
Posts: 65

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by jlinkels View Post
Gnuplot

jlinkels
Hello, thanks for the tip. I have searched gnuplot in google and it seems it could be just what I need, but the example source codes (http://gnuplot.sourceforge.net/demo/histograms.html) only make reference to an inmigration.dat file in which the data is stored. Do you know what is the format required to input this data? Thanks
 
Old 03-14-2009, 02:53 PM   #9
DeepSeaNautilus
Member
 
Registered: Jul 2008
Posts: 65

Original Poster
Rep: Reputation: 15
Smile

Quote:
Originally Posted by jschiwal View Post
You can use gnuplot to produce a bar graph & use the jpeg output driver. You may want to produce a file containing the data in a form gnu plot expects, write a gnuplot script that will use this datafile and create the jpeg graph, and then call: gnuplot <your_gnu_plot_script>.
From the info file:
Code:
   Examples:

   To plot a data file with solid filled boxes with a small vertical
space separating them (bargraph):

           set boxwidth 0.9 relative
           set style fill solid 1.0
           plot 'file.dat' with boxes
Also use locate to locate the html and/or pdf documentation for gnuplot.

Other options could be using postscript or latex graphic commands. There is a gnuplottex version of latex, but I don't know if you can produce jpeg files from the results.

There is also the plotutils package including the plot command. They can produce ps, png or psuedo-gif files as output which you could convert easily to jpeg.

From the plot info manual:
Code:
To produce a PNG file, you would do
     plot -T png < test.meta > test.png
If you will be using these plots for a college paper, you may want to use an eps output filter instead of png. LaTeX works better importing eps graphics. ( pdftex may be different )
Thanks a lot for the help , it seems that gnuplot is the right program for what I need. I have to install a separate jpeg output driver or is it integrated with gnuplot? I will start to read gnuplot docs and I will come back to post if I have any more doubts.
 
Old 03-14-2009, 03:38 PM   #10
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
Code:
NAME
       convert - convert between image formats as well as resize an image, blur, crop, despeckle, dither, draw on, flip, join, re-sample, and much more.

SYNOPSIS
       convert input-file [options] output-file

OVERVIEW
       The  convert  program is a member of the ImageMagick(1) suite of tools.  Use it to convert between image formats as well as resize an image, blur, crop, despeckle, dither, draw on, flip,
       join, re-sample, and much more.

       For more information about the convert command, point your browser to file:///usr/share/doc/ImageMagick-6.4.3/www/convert.html or http://www.imagemagick.org/script/convert.php.
to convert a file from png to jpg, simply use
convert <pngfilename> <jpegfilename>
or
more generally:
convert $pngfile ${pngfile%.png}.jpg

the plot and gnuplot programs may have documentation in your /usr/share/doc/ directory. I have html & pdf documentation. The pdf file is about 200 pages long.

Last edited by jschiwal; 03-14-2009 at 03:42 PM.
 
Old 03-14-2009, 04:46 PM   #11
DeepSeaNautilus
Member
 
Registered: Jul 2008
Posts: 65

Original Poster
Rep: Reputation: 15
Talking

Quote:
Originally Posted by jschiwal View Post
Code:
NAME
       convert - convert between image formats as well as resize an image, blur, crop, despeckle, dither, draw on, flip, join, re-sample, and much more.

SYNOPSIS
       convert input-file [options] output-file

OVERVIEW
       The  convert  program is a member of the ImageMagick(1) suite of tools.  Use it to convert between image formats as well as resize an image, blur, crop, despeckle, dither, draw on, flip,
       join, re-sample, and much more.

       For more information about the convert command, point your browser to file:///usr/share/doc/ImageMagick-6.4.3/www/convert.html or http://www.imagemagick.org/script/convert.php.
to convert a file from png to jpg, simply use
convert <pngfilename> <jpegfilename>
or
more generally:
convert $pngfile ${pngfile%.png}.jpg

the plot and gnuplot programs may have documentation in your /usr/share/doc/ directory. I have html & pdf documentation. The pdf file is about 200 pages long.
Thanks I already installed gnuplot and made my first graphs using a IBM Tutorial ( http://www.ibm.com/developerworks/li...r-wikiaGnuplot ), it seems really nice. I am currently compiling imagemagick and I think it is going to be very useful to me also. Thanks for being generous with your knowledge.

Last edited by DeepSeaNautilus; 06-17-2010 at 10:30 PM.
 
Old 03-15-2009, 12:48 PM   #12
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
Use your package manager to install ImageMagick. Only extremely small pendrive based distro's won't have it. The package will also install the documentation. The manpages for each ImageMagick program contain a link to documentation on their site:
file:///usr/share/doc/ImageMagick-6.4.3/www/convert.html or http://www.imagemagick.org/script/convert.php.

Your documentation may be in /usr/share/doc/packages/ImageMagick/ if you have SuSE Linux.

Last edited by jschiwal; 03-15-2009 at 12:49 PM.
 
Old 03-16-2009, 10:08 PM   #13
DeepSeaNautilus
Member
 
Registered: Jul 2008
Posts: 65

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by jschiwal View Post
Use your package manager to install ImageMagick. Only extremely small pendrive based distro's won't have it. The package will also install the documentation. The manpages for each ImageMagick program contain a link to documentation on their site:
file:///usr/share/doc/ImageMagick-6.4.3/www/convert.html or http://www.imagemagick.org/script/convert.php.

Your documentation may be in /usr/share/doc/packages/ImageMagick/ if you have SuSE Linux.
I got an error when I tried to install it by compiling it, so I installed it using my packet manager as you say and it works pretty well, thanks. I have seen a couple of examples of how to do bar charts in gnuplot, but I have not find the format required for the data.dat file than is referenced in the gnuplot file. Could you help me with this?
 
Old 03-17-2009, 06:08 PM   #14
DeepSeaNautilus
Member
 
Registered: Jul 2008
Posts: 65

Original Poster
Rep: Reputation: 15
how can I rotate the x label tags

Hello, I make this script for creating a bar chart:
set encoding iso_8859_1

Code:
set terminal postscript color
set output "example2.eps"


set xrange [0:30]
set yrange [0:5]
set xtics ("uno" 1, "dos" 2, "tres" 3, "cuatro" 4)

set data style boxes
set boxwidth 0.2

#comentario
plot "example.dat" using 1:2 title "first record"
The problem is that when I have a lot of data, the labels of the x axis overlap, is there any way I can rotate the tags 90 degrees?
 
Old 03-17-2009, 06:53 PM   #15
jlinkels
LQ Guru
 
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195

Rep: Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043
Yes you can.

Follow this link: http://www.gnuplot.info/docs/node193.html

All those pages together comprise a wonderful object which is commonly referred to as a manual.

jlinkels
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating complete new logo and graphics for new distro from PCLinuxOS skpanse Linux - Distributions 5 06-10-2011 03:16 PM
creating a log file of users who are missing a file gd121462 Linux - Newbie 5 12-04-2008 03:54 AM
Creating a PVR: Graphics card vs. TV tuner etc. Phyrexicaid Linux - Hardware 1 05-05-2007 10:13 AM
when creating a *.iso file, how to make the file size smaller? minm Linux - Newbie 8 12-26-2004 09:58 PM
creating 3D graphics greg108 Linux - Software 6 02-29-2004 01:50 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 05:42 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration