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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
|
03-14-2009, 11:56 AM
|
#1
|
Member
Registered: Jul 2008
Posts: 65
Rep:
|
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.
|
|
|
03-14-2009, 12:18 PM
|
#2
|
Bash Guru
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Arch + Xfce
Posts: 6,852
|
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?
|
|
|
03-14-2009, 12:31 PM
|
#3
|
LQ Guru
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,196
|
Gnuplot
jlinkels
|
|
|
03-14-2009, 12:43 PM
|
#4
|
LQ Veteran
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809
|
A spreadsheet program typically has plotting capabilities----something like OpenOffice calc will open most ordered files.
|
|
|
03-14-2009, 02:12 PM
|
#5
|
Member
Registered: Jul 2008
Posts: 65
Original Poster
Rep:
|
Quote:
Originally Posted by David the H.
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.
|
|
|
03-14-2009, 02:16 PM
|
#6
|
Member
Registered: Jul 2008
Posts: 65
Original Poster
Rep:
|
Quote:
Originally Posted by pixellany
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?
|
|
|
03-14-2009, 02:39 PM
|
#7
|
LQ Guru
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733
|
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.
|
|
|
03-14-2009, 02:42 PM
|
#8
|
Member
Registered: Jul 2008
Posts: 65
Original Poster
Rep:
|
Quote:
Originally Posted by jlinkels
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
|
|
|
03-14-2009, 02:53 PM
|
#9
|
Member
Registered: Jul 2008
Posts: 65
Original Poster
Rep:
|
Quote:
Originally Posted by jschiwal
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.
|
|
|
03-14-2009, 03:38 PM
|
#10
|
LQ Guru
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733
|
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.
|
|
|
03-14-2009, 04:46 PM
|
#11
|
Member
Registered: Jul 2008
Posts: 65
Original Poster
Rep:
|
Quote:
Originally Posted by jschiwal
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.
|
|
|
03-15-2009, 12:48 PM
|
#12
|
LQ Guru
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733
|
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.
|
|
|
03-16-2009, 10:08 PM
|
#13
|
Member
Registered: Jul 2008
Posts: 65
Original Poster
Rep:
|
Quote:
Originally Posted by jschiwal
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?
|
|
|
03-17-2009, 06:08 PM
|
#14
|
Member
Registered: Jul 2008
Posts: 65
Original Poster
Rep:
|
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?
|
|
|
03-17-2009, 06:53 PM
|
#15
|
LQ Guru
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,196
|
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
|
|
|
All times are GMT -5. The time now is 03:30 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|