gnuplot can't plot,how to fix it? - lua

I try to use Octave to plot data but failed. I can't find x11 or something in the list. Why do people say set environment to x11? How to fix it?
I try to use Octave to plot data but failed. I can't find x11 or something in the list. Why do people say set environment to x11? How to fix it?
I try to use Octave to plot data but failed. I can't find x11 or something in the list. Why do people say set environment to x11? How to fix it?
BlueCat56:Homebrew Mac$ gnuplot
G N U P L O T
Version 5.0 patchlevel 1 last modified 2015-06-07
Copyright (C) 1986-1993, 1998, 2004, 2007-2015
Thomas Williams, Colin Kelley and many others
gnuplot home: http://www.gnuplot.info
faq, bugs, etc: type "help FAQ"
immediate help: type "help" (plot window: hit 'h')
Terminal type set to 'unknown'
gnuplot> plot sin(x)
WARNING: Plotting with an 'unknown' terminal.
No output will be generated. Please select a terminal with 'set terminal'.
gnuplot> set terminal
Available terminal types:
canvas HTML Canvas object
cgm Computer Graphics Metafile
context ConTeXt with MetaFun (for PDF documents)
corel EPS format for CorelDRAW
dumb ascii art for anything that prints text
dxf dxf-file for AutoCad (default size 120x80)
eepic EEPIC -- extended LaTeX picture environment
emf Enhanced Metafile format
emtex LaTeX picture environment with emTeX specials
epslatex LaTeX picture environment using graphicx package
fig FIG graphics language for XFIG graphics editor
gif GIF images using libgd and TrueType fonts
hpgl HP7475 and relatives [number of pens] [eject]
jpeg JPEG images using libgd and TrueType fonts
latex LaTeX picture environment
lua Lua generic terminal driver
mf Metafont plotting standard
mp MetaPost plotting standard
pcl5 HP Designjet 750C, HP Laserjet III/IV, etc. (many options)
png PNG images using libgd and TrueType fonts
postscript PostScript graphics, including EPSF embedded files (*.eps)
pslatex LaTeX picture environment with PostScript \specials
pstex plain TeX with PostScript \specials
pstricks LaTeX picture environment with PSTricks macros
qms QMS/QUIC Laser printer (also Talaris 1200 and others)
svg W3C Scalable Vector Graphics
tek40xx Tektronix 4010 and others; most TEK emulators
tek410x Tektronix 4106, 4107, 4109 and 420X terminals
texdraw LaTeX texdraw environment
tgif TGIF X11 [mode] [x,y] [dashed] ["font" [fontsize]]
tikz TeX TikZ graphics macros via the lua script driver
tkcanvas Tk/Tcl canvas widget [perltk] [interactive]
tpic TPIC -- LaTeX picture environment with tpic \specials
unknown Unknown terminal type - not a plotting device
vttek VT-like tek40xx terminal emulator
xterm Xterm Tektronix 4014 Mode
gnuplot>

Related

How do I convert from postscript/gnuplot to pdf maintaining accented letters for latex document?

So I have to write my lab report in Italian for my lab class. In class they taught us how to use gnuplot to create graphs, so I'm using it to produce our graphs, which then I need to put in my latex document. The problem is that I have to set the label on the y axes as "velocità", and when I then save the file in ps and convert in pdf the 'à' disappears or is substituted by something else. What I've tried doing is using variations of the commands
set encoding iso_8859_1
set ylabel "velocit\340"
then I saved the plot using set term postscript color, set output "graf.ps", replot, and from the wsl terminal, using ps2pdf, I converted it into a pdf, but when I open the pdf, the letter 'à' doesn't appear anymore, even though it did show in graph previously generated by gnuplot. What should I do? In case, is there another way I can attach the original graph in my latex document?
Gnuplot provides several LaTeX-friendly terminal types. Postscript is not one of them. Postscript's character encodings are idiosyncratic at best. If your goal is to include gnuplot output in latex, then choose a terminal type that is designed for it. Some terminal types (e.g. cairolatex) work only with latex because they depend on latex to do all the text processing. Others (e.g. pdf, png, tikz) produce output that is fully compatible with latex but already has the text embedded in it. It is best to use UTF-8 encoding for everything, including your accented characters. For example:
set term pdf size 7cm,5cm
set output 'myfigure.pdf'
set encoding utf8
set ylabel "velocità"
set xlabel "tempo"
plot [0:10] x**2 title "velocità"
Then in your latex document, something like:
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
...
My TeX document.
\begin{figure}[h]
\includegraphics{myfigure}
\end{figure}
...

How to output multiple pages in gnuplot cairolatex terminal?

As written in the title, I am trying to create a multipage pdf with gnuplots cairolatex terminal.
I am using gnuplot 5.4 in cygwin.
Single page works fine, i.e.
./gnuplot-script
pdflatex plot.tex
However when I plot multiple pages in the gnuplot-script, the output .tex file seems to contain errors ..
E.g. the gnuplot-script
set terminal cairolatex standalone
set output "plot.tex"
plot x
plot x**2
outputs a plot.tex that contains two \documentclass{minimal} and pdflatex then complains with
! LaTeX Error: Can be used only in preamble.
...
l.181 \documentclass
{minimal}
I can workaround this by putting each plot into a new file, but it seems a bit strange that simple multipage output is bugged in this terminal?
Am I missing some special command to start a new page in the cairolatex terminal or something? I don't see anything in the documentation for this ..
If you really need to create a TeX-based multipage pdf file directly from gnuplot, I suggest to use the tikz terminal rather than cairolatex.
set terminal tikz standalone
set output "plot.tex"
plot x
plot x**2
unset output
!pdflatex plot

How to save plots as colorful .eps in octave

I am using win7 and octave 3.6.4,
when i generate a plot with octave and save as .eps its colors go away.
For example :
clf();
surf(peaks);
generates following graphic
But when i run the following codes seperately
saveas (1,"test.eps") or print (1,"test.eps") or print -deps test.eps
to save the graphic as .eps and import it into latex it becomes grayscale.
Try
print -depsc test.eps
or
print -color -depsc test.eps
if the first one doesn't work.
EDIT:
Which graphics toolkit are you using? with gnuplot, it works just fine for me (Octave 3.6.2, Win XP) using the -eps flag.
you can use
print -dtex test.tex
Octave automatically exports your figure into LaTeX/Color EPS figure, with LaTeX fonts.

gnuplot epslatex functionality in matplotlib

I am used to plot data with gnuplot, so I can easily put the figures in a LaTeX document, using the epslatex terminal. For example:
file = "data.dat"
set terminal epslatex
set output "figure1.tex"
plot file
This way, two files are generated: one .eps file, which contains the graphics, and one .tex file, which contains the text. The great advantage of this is that text is rendered by LaTeX, so the tics, labels, etc. have the same font as the rest of the document.
Now I am starting with matplotlib, which has a much nicer API, is more scriptable and, well, is Python. But, even though I can make matplotlib render the text with LaTeX, it gets embedded into the image and I cannot achieve the same advantages I had with gnuplot.
Is there any way I can emulate the epslatex terminal in matplotlib?
Update: matplotlib 1.2 introduced a new PGF/TikZ backend, and I have successfully used it for the exact purpose stated in this question: make LaTeX / XeTeX render the text of the plot. In the documentation there are some nice examples of plotting using the PGF backend, including custom preambles, custom fonts and full unicode math support.

LaTeX font in Postscript document

I am starting off with Postscript, and would like to do something very simple: include a LaTeX symbol within my Postscript document. For example:
%!
/FontSize 12 def
newpath
0 0 moveto
("Hello \LaTeX") show % This is where I would like
% the rendering of \LaTeX
% with actual LaTeX font
showpage
Any ideas?
The \LaTeX logo is just normal letters moved slightly around via kerning. So if you're already hacking raw postscript commands, you should just copy the dimensions from the definition in latex.ltx and issue the same movement commands between the letters in postscript. Ditto to select the CM font, or whatever you would like.
If the aim is to mix together Postscript and Latex in one document, you can use Metapost. Hans Hagen's Metafun manual is the best introduction to Metapost I know of, although note that:
He assumes that you will be using Tex or Context and not Latex. If you want to use Latex macros in Metapost, you will need some additional boilerplate;
Metafun is a slight superset of regular Metapost; and
He more or less ignores the ability of Metapost to embed raw Postscript — the core of the Metapost language is an extension of Knuth's Metafont, and is quite unlike Postscript.
Cf. also Troy Henderson's Embedding fonts in MetaPost output, which explains how to embed Tex fonts in the Postscript files generated by Metapost.

Resources