Graphics, Figures & Tableslow resolution plot tikz / gnuplot

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
didius
Posts: 4
Joined: Mon Jul 12, 2010 8:36 pm

low resolution plot tikz / gnuplot

Post by didius »

Hi

I have upgraded gnuplot and tikz today, everything works, but the plots are pretty low resolution now.

The following code compiles into:

Code: Select all

\begin{tikzpicture}[domain=-4:4, scale=0.75,baseline=(current bounding box.north)] 
\draw[very thin,color=gray] (-3.9,-3.9) grid (3.9,3.9); 
\draw[-stealth] (-4.2,0) -- (4.2,0) node[above] {$x$}; 
\draw[-stealth] (0,-4.2) -- (0,4.2) node[left] {$y$}; 
\draw[thick,color=green!50!black] plot[id=x] function{sqrt(x)}; 
\draw (1,0) node [below] {1};
\draw (0,1) node [left] {1};
\draw (0,0) node [below left] {0};
\draw[thick,color=green!50!black,fill=white] (0,0) circle (2pt);
\end{tikzpicture} 
Image

Before the update it was pretty low resolution but still beter, example:
Image

Why is the first part of the graph not curvy? How can i fix this?
Last edited by didius on Mon Jul 12, 2010 9:25 pm, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

Learn LaTeX easily with newest books:

The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis

The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more

LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis

User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

low resolution plot tikz / gnuplot

Post by localghost »

You can get a smoother plot by increasing the samples value (default 25). See pgf/tikZ manual (Section 18.5 - Plotting a function, p. 194f).

Code: Select all

\draw[thick,color=green!50!black] plot[id=x,samples=100] function{sqrt(x)};
Depending on that value it will cost you some more time for compilation.


Best regards and welcome to the board
Thorsten
didius
Posts: 4
Joined: Mon Jul 12, 2010 8:36 pm

Re: low resolution plot tikz / gnuplot

Post by didius »

Thanks localghost!

Setting the samples value to 500 made it look stunning!
Post Reply