Tag Info

Hot answers tagged

213

This has been a topic for a few questions on this site and you can find many examples of such human-like typesetting, the most famous being the great How do I make my document look like it was written by a Cthulhu-worshipping madman? and also slightly related ones Simulating hand-drawn lines TikZ two-blocks matrix that I can remember (because I've ...


53

If creating plots using matplotlib (python) is an option, take a look at "XKCDify " (sorry, this isn't a "TeX answer", but inclusion of matplotlib-generated plots in TeX documents is common enough I think it's worth mentioning this here).


45

You can use pgfplots to plot the functions. There's no standard macro for it, but the function isn't too complicated and can be added as a pgfmath function (based on this answer: How do I use pgfmathdeclarefunction to create define a new pgf function?): \documentclass{article} \usepackage{pgfplots} \begin{document} \pgfmathdeclarefunction{gauss}{2}{% ...


39

Wasn't sure if "something like that" meant "as near to that as possible". Either way I went with: \documentclass{standalone} \usepackage{tikz} \renewcommand{\familydefault}{\sfdefault} \begin{document} \colorlet{crystal}{blue!75} \def\zangle{-20} \def\xangle{20} \begin{tikzpicture}[x=(\xangle:0.75cm), y=(90:1cm), z=(\zangle:1.5cm), >=stealth, line ...


34

To be honest, I don't understand the spiral code to well, at lest not why switching the roles of x and z leads to strange results. So I would recommend using Tikz's plot operation: Code \documentclass[a4paper,11pt]{article} \usepackage{kerkis} \usepackage{tikz} \usetikzlibrary{% calc,% fadings,% shadings% } ...


31

Disclaimer Take this as a starting point: there are a few things to be done to make the solution really working in all cases. Namely: handle cases where remainder(max/min)!=0 handle min!=0 handle scale from max to min besides min to max A possibility: \documentclass[tikz,border=10pt]{standalone} \usepackage{pdftexcmds,etoolbox} \makeatletter ...


25

You can use the \pgfplotstablevertcat command to add the coordinates to your data and then just use the fill option when plotting: \documentclass{article} \usepackage{pgfplots} \usepackage{pgfplotstable} \begin{document} \begin{tikzpicture} % Load the data \pgfplotstableread{data.dat}\data % Input the coordinates for the fill boundary, sort them from ...


25

In this answer, I will explain how to make animations in both PDF and GIF format: Make sure you have installed the following applications and set the PATH system variable to their locations. TeXLive or MikTeX. GhostScript. You can install either the 32 or 64 bit version. The corresponding application names for 32 bit and 64 bit are gswin32c.exe and ...


25

Here's a way of doing this with PGFPlots: The first plot is simply a ycomb plot, and the second I would draw using separate plots for the areas (with a trailing \closedcycle to get the filling right) and the lines. \documentclass{article} \usepackage{pgfplots} \usepackage{filecontents} \begin{filecontents}{data.dat} 3.045784 3.415896 3.405784 ...


24

The combination of »pgfplots« and »pgfplotstable« is your friend here. Together with »array« and »booktabs« for enhanced formatting you get both a nice table and a nice plot. The advantage is that if you modify the data file, the modifications will be respected in the table as well as the plot. Further customization is of course possible (see package ...


22

Aha, Jake was way faster. \documentclass{article} \usepackage{pgfplots} \pgfplotsset{compat=1.7} \begin{document} \begin{tikzpicture} \begin{axis}[ enlargelimits=false, axis background/.style={shade,top color=gray!20,bottom color=white}, ] \addplot[ycomb,mark=*,mark color=black,domain=2:10,samples=70] {rnd+(x)^0.3333}; \end{axis} \end{tikzpicture} ...


21

It is possible, but it does not neccessarily help understanding. The first is a rotation with constant angular velocity about the z-axis, which you probably get from the picture. But it gets quite incomprehendable from there: I wouldn't know what the second one is. So I started experimenting. The next two explore the possibility to draw surfaces connecting ...


19

I would recommend that you plot these outside of Wolfram Alpha and just use LaTeX. Here is a pgfplots version that should get you started: \documentclass[border=5pt]{standalone} \usepackage{pgfplots} \begin{document} \begin{tikzpicture} \begin{axis}[ thick,smooth,no markers,samples=100, ymin=-1.2,ymax=0.5,xmin=-1.5,xmax=1, ...


17

After all my failed attempts (deleted) I got one version to work. The problem was, that inside of the axis environment the loop of \DTLforeach didn't expand the macros at the proper moment, but after the loop ended. This led to the result that only one (i.e. the last) box was drawn. This solution circumvents this as it assembles all the TikZ commands ...


17

The pst-func package knows \psWeierstrass(x0,x1)[a]{a or b}. It uses the function from http://mathworld.wolfram.com/WeierstrassFunction.html or, if the optional argument is given, the original one, seen here http://en.wikipedia.org/wiki/Weierstrass_function: \documentclass[pstricks,border=10pt]{standalone} \usepackage{pst-func} \begin{document} ...


16

Here's a pgfmath function definition of the original Weierstrass function: weierstrass(x,a,b,i). i is the number of iterations to be used for approximating the function. \documentclass{article} \usepackage{pgfplots} \makeatletter \pgfmathdeclarefunction{weierstrass}{4}{% \pgfmathfloattofixed@{#4}% \afterassignment\pgfmath@x% ...


16

You can use pgfplots for this too. \documentclass{article} \usepackage{pgfplots} \begin{document} \begin{tikzpicture} \begin{axis}[view={-30}{30},no markers,zmax=30, z post scale=2, x post scale=0.5, enlargelimits=false, ymax=5,ymin=-5, xmax=5,xmin=-5] \addplot3+[domain=-0:30,samples=200,samples ...


16

To begin with, I would recommend moving your example to use pgfplots, and then work it out. $1000 cheaper you get this (code below) \documentclass{article} \usepackage{pgfplots} \usepackage{filecontents} \begin{filecontents}{data.dat} 3.045784 3.415896 3.405784 4.025693 3.785784 4.522530 4.125784 5.538449 4.485784 ...


15

I don’t know how exact the curve should be but if the shapt isn’t that important you could use the bend or the in and out options to draw. The first thing is to set up a TikZ environment and draw the axes. Use \draw to draw a line, ad the tip with -> and the label with a node. \documentclass{article} \usepackage{tikz} \begin{document} ...


15

I'm sure we've answered this before, but here's a solution using pgfplots. When plotting cube root functions it is useful to know that many programs (including the wonderful pgfplots package) use logarithms to plot them. As such, you have to be careful with the domain. In the code below, I have plotted the function x/|x|*(|x|)^(1/3) which ensures that ...


15

Due to precision problems with calculation with TikZ, I change the approach and use a small pearl script to do this calculations. Run with pdflatex -shell-script I use decorations.markings library to do graduations on every type of path. (No more accumulations of marks problem). I tried to put some explainations in the code. The code : ...


14

With PSTricks. Option 1 (with Postfix Notation) \documentclass[pstricks,border=12pt]{standalone} \usepackage{pst-plot} \begin{document} \begin{pspicture}(-3.5,-2.5)(4,3) \psaxes{->}(0,0)(-3.5,-2.5)(3.5,2.5)[$x$,0][$y$,90] \pstVerb{/power 1 3 div def} \psplot[plotpoints=1000,linecolor=blue]{-3}{3}{x dup 0 lt {neg power exp neg} {power exp} ...


14

\documentclass{article} \usepackage{tikz} \begin{document} \begin{tikzpicture} \draw [->] (-1,0) -- (11,0) node [right] {$x$}; \draw [->] (0,-1) -- (0,6) node [above] {$y$}; \node at (0,0) [below left] {$0$}; \draw plot[smooth, tension=.7] coordinates{(1.5,-0.5) (3,3) (5,1.5) (7.5,4) (10,-1)}; \node at (1.75,-0.25) {$a$}; ...


14

If you need to plot a series of points in the spreadsheet you could use the pgfplots packet. First of all export your data as a csv file (Comma Separated Values). Then you can easily plot the points, I made a small example for you: \begin{figure}[h!] \centering \begin{tikzpicture} % %% NB: Declare logarithmic axis \begin{loglogaxis}[ % Labels for the ...


14

Depending on what exactly you're trying to highlight with the inset, the spy library might be useful for you. It creates an insert with a magnified part of a TikZ picture. In order to use the axis cs: coordinate system for specifying which part to magnify, you have to create a coordinate node in the axis, as axis cs: is not available inside the \spy ...


13

With TikZ version 2 : \documentclass{article} \usepackage{tikz} \begin{document} \begin{tikzpicture}[scale=.5] \draw[->] (-10, 0) -- (10, 0) node[right] {$x$}; \draw[->] (0, -10) -- (0, 10) node[above] {$y$}; \draw[color=red, domain=-10:-0.1,samples=200] plot[id=x1] function{1/x}; \draw[color=red, ...


13

You can (ab)use stack plots. Simply subtract the first function from the second to undo the stacking. \documentclass{article} \usepackage{tikz,pgfplots} \begin{document} \begin{tikzpicture} \begin{axis}[stack plots=y,thick,smooth,no markers] \addplot+[black] gnuplot{sin(x)}; \addplot+[black,fill=blue!50] ...


13

Asymptote contour3 package draws 3D surfaces described as the null space of real-valued functions of (x, y, z). Note that the images here are rendered into raster format (png). % impsurf.tex : % \documentclass[10pt,a4paper]{article} \usepackage{lmodern} \usepackage{subcaption} \usepackage[inline]{asymptote} ...


13

You're dividing by nearly zero, so that result is in a way expected. You could use restrict y to domain=0:20 to remove all y-values larger than 20, or (easier) just add ymax=25 to set the maximum value for the y-axis. The difference between the two is that the former removes all calculated y-values that are outside the given domain from the plot, while the ...


13

Here's an attempt using Asymptote. I took literally your statement that "any spirally shape" would be okay. To compile it, save the code below in a file called (e.g.) filename.tex and then run pdflatex --shell-escape filename. (Also, make sure you have Asymptote installed.) \documentclass[margin=10pt,convert]{standalone} \usepackage{asypictureB} ...



Only top voted, non community-wiki answers of a minimum length are eligible