## quality graph with gnuplot and latex

I want to include graphics in a latex document, so I used various terminal (png, jpg) in gnuplot but when I include in latex, the result it isn't very good...i would coloured graph , so which terminal i can use? what pagkage i have to include in tex file?

Thanks for helpers

 PhysOrg.com science news on PhysOrg.com >> 'Whodunnit' of Irish potato famine solved>> The mammoth's lament: Study shows how cosmic impact sparked devastating climate change>> Curiosity Mars rover drills second rock target
 Recognitions: Homework Help Pure LaTeX prefers postscript or encapsulated postscript (ps or eps) files. These can get very big, especially for color. PdfLaTeX will handle many different compressed file formats, which will look bad if you scale them in your document - especially graphs, like those produced by gnu plot, which usually have thin lines. The answer is to create the images at the size you want to use it - maybe rescaling it with an image manipulaton program (I use GIMP for eg.) For graphs or diagrams which have lots of lines and thin bits that are important, you want a format that uses lossless compression like png.
 Blog Entries: 47 Recognitions: Gold Member Homework Help Science Advisor What is the nature of the graphics? If the graphics are fine lines and dots, then use vector-formats (like .eps) since they look better when rescaled. Otherwise, use raster-formats (like .png). Have you seen http://t16web.lanl.gov/Kawano/gnuplot/postscript-e.html In latex, use the graphics or graphicx packages. http://t16web.lanl.gov/Kawano/gnuplot/postproc-e.html

## quality graph with gnuplot and latex

 Quote by robphy What is the nature of the graphics? If the graphics are fine lines and dots, then use vector-formats (like .eps) since they look better when rescaled. Otherwise, use raster-formats (like .png). Have you seen http://t16web.lanl.gov/Kawano/gnuplot/postscript-e.html In latex, use the graphics or graphicx packages. http://t16web.lanl.gov/Kawano/gnuplot/postproc-e.html
in the graphs are fine lines and dots...I try to set terminal gnuplot:
Code:
set terminal epslatex size 4,2.82 standalone color colortext 9
set output 'image.tex'
plot f(x) # example
but i want to insert graph in a tex file, to be converted in a pdf file. so:

Code:
latex image.tex
dvips image.dvi
ps2pdf image.ps
and then in tex file:
Code:
\includegraphics[scale=1.00]{image.pdf}
.

The result is fine, but there is a better solution?

 Blog Entries: 47 Recognitions: Gold Member Homework Help Science Advisor Maybe something like this.... set terminal postscript size 4,2.82 standalone color colortext 9 set output 'image.eps' plot f(x) # example and then in the latex file: \includegraphics[scale=1.00]{image.eps}

 Quote by robphy Maybe something like this.... set terminal postscript size 4,2.82 standalone color colortext 9 set output 'image.eps' plot f(x) # example and then in the latex file: \includegraphics[scale=1.00]{image.eps}
generating pdf file the graph doesn't appear: i use gedit-latex plugin so i export in pdf pressing ctr+alt+1...

 Recognitions: Homework Help I've been using: \usepackage[pdftex]{color,graphicx} In the body: Code: \begin{figure} \centering \includegraphics[angle=0, width=0.67\textwidth]{my-pic.png} \end{figure} [actually reads what I've been told] Oh yeah - it is supposed to do pdf - I'll go try to repeat your problem.  Hmmm ... works for me using: ps2pdf testimage.eps ... and using the same \includegraphics[scale=1]{testimage.pdf} ... you did. Suggest: 1. check the image is not blank at each stage in the processing 2. use pdflatex directly in the terminal 3. try just using the ps Sounds to me like your shortcut is only invoking latex, not pdflatex.
 this is the preamble: Code: \documentclass[a4paper,italian,12pt]{article} \usepackage{babel} \usepackage[hmargin=2.5cm,vmargin=2.5cm,dvips]{geometry} %%\usepackage{draftcopy} \usepackage[latin1]{inputenc} \usepackage{ae} \usepackage{aecompl} \usepackage{aeguill} \usepackage{textcomp} \usepackage{mathcomp} %% \usepackage[draft]{graphicx} \usepackage[final]{graphicx} \usepackage{latexsym} \usepackage{amstext} %% \usepackage[mathlines,pagewise]{lineno} \usepackage{xspace} \usepackage[section,below]{placeins} \usepackage{array} \usepackage{tabularx} \usepackage{subfigure} \usepackage[small]{caption} \usepackage{url} \usepackage{booktabs} \usepackage{afterpage} \usepackage{parskip} ... \begin{center} \includegraphics[scale=1.60]{img/image.eps} \label{fig:image} \end{center} when i use pdflatex: Code: ! LaTeX Error: Unknown graphics extension: .eps.
 Recognitions: Homework Help pdflatex does not recognize eps. It should recognize .pdf though. Use regular LaTeX for eps files. (when testing, change only one thing at a time.) I'm getting a blank page instead of an image - this what you get? The error is: LaTeX Warning: Float too large for page [...] When I convert to pdf, the image is A4 size with the image in the bottom-left corner - which is off the bottom of the page! epstopdf image.eps creates a properly dimentioned file. I tried this with your code, (Oh cool - Italian!) and all your includes (jic there were conflicting packages) and it worked for me. Curiously, when I use just plain latex I get an error: ! LaTeX Error: Cannot determine size of graphic in image.pdf (no BoundingBox). But it works anyway ... so I guess I was wrong about latex graphicx not accepting pdf format.
 yes, converting eps or ps to a pdf it works... but in this way the quality of lines became a bit low :(
 Recognitions: Homework Help Though you are scaling up - so you must get pixelation. You don't seem to be invoking any of the special features of pdf files, you you could load the eps file in the .tex then use normal latex to get a .dvi file, then dvipdf. Even so - recall that pdf uses (lossy) jpeg compression. If you just need to print it - use dvips instead and print the (likely huge) ps document. If you need to submit electronically, maybe they will accept a ps document compressed with zip? You can use a plotting program other than gnu-plot - pl-plot for eg also has octave bindings (which is how I use gnu-plot). However: I just run gnu-plot outputs through GIMP > filter > enhance > anti-alias. Also good for labeling them in a nice font, and resizing (smart enlarge or use the standard interpolation). If you have lots, then you'll want script-fu or just write a shell-script for image-magick.
 Blog Entries: 9 Recognitions: Gold Member You could also try converting the image from .eps to .png with ImageMagick (sudo apt-get install imagemagick should work for Debian-based distros). In a terminal: Code: convert -density 300 image.eps image.pdf I use a script that calls this to convert MATLAB generated .eps files to PNG for pdf$\LaTeX$. Increasing the image density should increase quality at the expense of a larger image size.
 Blog Entries: 47 Recognitions: Gold Member Homework Help Science Advisor I don't use pdflatex, partly because of the lack of .eps support, and partly because i am comfortable with the latex -> dvips -> ps2pdf script that I use. I'd prefer keep the [original] vector-graphics, rather than converting it to a raster format, then including that alternate file.
 Recognitions: Science Advisor You need to indetsand the difference between bitmap graphics and vector graphics here. If you want to preserve "high quality" graphics when you to scale them to any size, you need vector graphics which defines each line by the "exact" coordinates of its end points, not bitmap graphics which defines a rectangular grid of pixels. When you scale bitmap graphics, the pixels just get bigger. When you scale vector graphics, the software "re-draws" the lines at the new scale to make the best use of the screen or printer resolution. PS, EPS, and PDF files can contain either bitmap or vector graphics, so you need to make sure that when you convert PS or EPS to a PDF you don't "accidentally" convert vector graphics into a bitmap. Somebody said "PDF uses lossy compression". Again that is only partly true - PDF can use either lossy or lossless compression, or no compresssion at all. The bottom line is that the EPSTOPDF program that comes with most versions of TeX does the conversion right. If the EPS file is vector graphics from GNUPLOT, the PDF will contain the exact same vector graphics. Other file conversion programs might do it wrong, or have the options that let you choose whether to do it right or wrong (but why bother, since EPSTOPDF doesn't have any options, and does it right). PNG is a bitmap graphics format with lossless compression. so it will work fine providing you don't want to scale the images. Otherwise, unless you have very complex plots from GNUPLOT, there's unlikely to be any advantage in terms of file size in using PNG rather than EPS and PDF.

Recognitions:
Homework Help
Well fair enough - in post #4, it was a bit unclear what you were doing to what.
It started out looking like you converted some image to pdf for inclusion into your document.

 gedit-latex plugin so i export in pdf pressing ctr+alt+1
... which suggested you were using pdflatex directly via this plugin.

 The result is fine, but there is a better solution?
Define "better"? How would you decide?

The sort answer is "yes - but..."

When other suggestions for post-processing were suggested, you respond:
 I'd prefer keep the [original] vector-graphics, rather than converting it to a raster format, then including that alternate file.
Well then you prefer the lower quality.

You could try plplot instead, or use the scilab plotting library. Or shell out for a commercial math-script engine like mathematica or matlab.

 Recognitions: Homework Help dvipdf is the conversion utility used - iirc it does not support FlateEncode? I suppose he should also use dvipdfm instead of dvipdf, supports flate, his text would look better too. Not found how to flag this on CLI, though the -z option sets the compression ratio. afaik the default is still DCTEncode Instead you have to open up your .eps file in a text editor and insert the following after the end of the "%" commented area at the beginning of the file: Code: systemdict /setdistillerparams known { << /AutoFilterColorImages false /ColorImageFilter /FlateEncode >> setdistillerparams } if Another option may be to use tex4ht, then open the .odt file in OpenOffice.org or Libre Office, and use the distiller there to create the PDF. Those programs have a GUI to select the PDF options and it defaults to lossless. Doesn't convert all that nicely into OO fonts though, probably have to fiddle with the cli options. One can also export directly from Lyx, never tried. Rasterizing images is the recommended "best practice" where file-size is important. ------------------------------------- references: http://electron.mit.edu/~gsteele/pdf/ http://gaspra.kettering.edu/dvipdfm/dvipdfm-0.12.4.pdf
 i don't say this: "I'd prefer keep the [original] vector-graphics, rather than converting it to a raster format, then including that alternate file." i'm dirac68!