Questions tagged [plot]

{plot} is for questions concerned with plotting data or functions using TeX. For questions specific to the pgfplots package, use the {pgfplots} tag.

Filter by
Sorted by
Tagged with
14
votes
1answer
4k views

pgfplots - Placing Nodes on x Coordinates of a Plot

I want to plot some graphs in pgfplots and want to place nodes on the exact same x coordinate of the plot. The position of the note has to be set in x direction but free in y direction. Here is one ...
9
votes
5answers
5k views

How can I draw dirac deltas with arrow heads with pgfplots

I would like to draw this in pgfplots: I've tried this, but I can't figure out how to get the arrowheads. \documentclass{article} \usepackage{pgfplots} \begin{document} \begin{tikzpicture} \...
8
votes
1answer
3k views

error bar colors in scatter plot

A data file contains four columns: x, y, error on y, class. class is an integer which I feed to scatter src so i get a graph that has different colors for different classes. However, the error bars ...
7
votes
1answer
1k views

Histogram: different color for each bar

I have the following code. \documentclass[a4paper,twoside,12pt]{article} \usepackage[T1]{fontenc} \usepackage[utf8x]{inputenc} \usepackage[english]{babel} \usepackage{pgfplotstable} \definecolor{...
6
votes
2answers
5k views

Bar plot labels and grids

\documentclass[a4paper,11pt]{report} \usepackage{tikz} \usepackage{verbatim} \usepackage{pgfplots} \begin{document} \begin{tikzpicture} \begin{axis}[ title = {Optimalization based upon co-occurences}, ...
5
votes
3answers
1k views

Plot bessel functions

Is there any way of producing first and second kind bessel functions? What about modified bessel functions? I want to have J_{\nu} (x) , Y_{\nu} (x), I_{\nu} (x) and K_{\nu} (x) in a separate ...
5
votes
1answer
2k views

Plotting a 2D gaussian sample

Can you please help me with making a 2D Guassian sample with specified means and variances? I only know how to make a guassian curve :D \documentclass{article} \usepackage{paralist,pst-func, pst-...
4
votes
3answers
2k views

plotting a linear programming problem

I am a beginner in LaTeX, but I am learning as I go. I want to plot the following linear programing problem: (plot: to make a graphic) f(x,y) = 2x - 3y -> max x + y <= 12 x,y >=0 Here is ...
3
votes
1answer
498 views

Drawing function in tikzpicture

I have to draw function with \plot but it says "Dimension too large", this is my code: \begin{tikzpicture} \begin{axis}[grid=major, xmin=0, xmax=3, ymin=-1.5, ymax=1.5, xlabel=$t$, ylabel=$x(t), y(...
9
votes
3answers
775 views

How can I move a single node in a tikz plot?

I can't find an answer online, please help me. The following plot shows the percentage of 3 groups. The red line is the average (and needs to stay at 13.8). How can I move ONLY the node "2.9" a ...
8
votes
4answers
2k views

tikz/pgfplot — always same distance between marks

Is there a way to get for all tikz-plots in one LaTeX document the same distance between the plot marks, ie the distance between the marks should be independent of sample size. It would be really ...
8
votes
2answers
3k views

Fill area of curve above a line using pgfplots

This question is related to Fill between two curves in pgfplots. which started me of. However, I need to have just the area above the reference line filled. \begin{tikzpicture} \pgfplotstableread{...
7
votes
3answers
1k views

Plotting the graph for exp(cos(1/x))

I am having issues plotting the function exp(cos(1/x)) in the domain (0,1) with pgfplots and TikZ using a normal addplot command with the function exp(cos(deg(1/x))). It seems LaTeX is having some ...
6
votes
1answer
3k views

Bell curve with multiple x-axes and annotations

I've just started working with pgfplots and I'm getting good results, but I'm having difficulties getting this one done in LaTeX: The curve itself is not a problem, but the multiple x-axes (I don't ...
5
votes
1answer
1k views

plot a rational function with TikZ

I am trying to plot a function but something is incorrectly written... Could anyone please help me? \documentclass[12pt,a4paper]{article} \usepackage{amsmath, tikz} \usepackage[margin=3cm]{geometry} \...
5
votes
3answers
1k views

How do I draw graphs?

I'm new to Latex and I think I am going to use it for my physics classes in school. I have found a really good template: https://www.sharelatex.com/templates/journals/aip/ (I use sharelatex) which is ...
3
votes
1answer
227 views

Plot 8th roots of unity on complex plane with PGFPlots

This is what I currently have \begin{figure}[h] \centering \begin{tikzpicture} \begin{axis}[axis equal, axis lines=center, xlabel=$\Re$, ymax=1.5,ymin=-1.5, ...
3
votes
1answer
1k views

Plot Tikz graph defined with two variables, ie 4=x^2+y^2

I want to plot a graph of 4=(x-2)^2+(y-2)^2, How do I do that within tikz plot? I have tried re-arranging but it just throws errors at me! \draw [domain=0:4] plot ({\x},{2-\sqrt{4\x-\x*\x}}); Is there ...
1
vote
1answer
140 views

pgfplots: Using “x filter” to decrease point density of plot

The user esdd has posted a nice approach on how to increase point density for a certain range of data points while the remaining plot keeps low point density by using x filter. Minimum Working ...
0
votes
2answers
535 views

R Sweave not interpreted correctly due to writing style?

This case won't get correctly interpreted. I doubt it must be to do something with my writing style but I cannot notice what it is. You can run it with R CMD Sweave Test.Rnw; pdflatex Test.tex ...
7
votes
2answers
381 views

Why does a plot of a reciprocal function using pgfplots look wrong?

I am trying to plot the function 1/x^2 but the result is obviously wrong, here is how it looks like here is the code \begin{center} \begin{tikzpicture} \begin{axis}[ %xlabel=$x$, %...
6
votes
1answer
938 views

Uniformly spaced line markers

I'm reading line data from file and plotting it. By default, the curve has markers, where are the original data points. The data points are very uneven, but I would like to have evenly distributed ...
5
votes
1answer
826 views

How can I restrict `pgfplots` plot to an interval manually?

OK, I've plotted these graphs but am unable to stretch the second one, so that they both have the same values on the vertical lines drawn from one to another. I've tried to set domain=0:2200 for both ...
4
votes
2answers
752 views

How to use Tikz/Pgfplots to plot an algebraic curve on a restricted domain?

I want to plot for example equation y^2 x + x^3-3y^2-2x^2+x=0. But at the same time I need to gray out some parts of the plane (see shaded area). Is there a way to do this?
3
votes
1answer
537 views

Remove duplicate labels with symbolic y coords

I am new to pgfplots and have a problem with the following example: \begin{tikzpicture} \begin{axis}[title = Some fancy benchmark data, xbar, y axis line style = { opacity = 0 }, axis ...
3
votes
3answers
2k views

Hysteresis Loop

I am new to latex. I'm doing my MA thesis on Magnetic Materials. I don't know how to draw this diagram in LaTeX. I would be grateful if you can help me with this image. Thanks.
2
votes
2answers
73 views

pgfplots: Restrict “each nth point” to specific domain only?

I have a huge amount of data. Therefore I want to reduce the data displayed by decreasing the amount of points with each nth point = {!value!}". Minimum Working Example (MWE): \documentclass[tikz]{...
2
votes
2answers
2k views

Bar chart from CSV file with adjustable bar width

I have a CSV file with approximately 1500 records that I would like to plot using something like a bar chart, but I don't know where to start at all. Each record contains a width and a height, which ...
2
votes
1answer
188 views

pgfplots: How to create heatmap with date as x-axis?

Assumed we want to draw a nice heatmap in pgfplots with date as x-axis. Minimum Working Example (MWE): \documentclass[tikz]{standalone} \usepackage{pgfplots} \usetikzlibrary{positioning,calc}% \...
2
votes
1answer
989 views

How to draw the graph of function x+y=100

Following is the code for drawing the graph of x+y=4. Now i am thinking to draw the graph of x+y=100 for that what are the necessary changes in the given codes. \documentclass[12pt,a4paper]{article} \...
2
votes
2answers
5k views

Horizontal bar chart with different colors for each bar

I want to create a horizontal bar chart with different labels on the y-axis for each bar. Also, the value should be displayed on the right-hand side of each bar. Fx: "Test A" ... red bar ... 400 "...
1
vote
1answer
149 views

How to plot this diagram?

I have to plot this diagram, as shown in the picture. But couldn't find the way to do so in latex, very easy to do in paint and then include it in latex. But can I write something to get such as the ...
1
vote
1answer
319 views

Graph with multiple Y axes

How do I create a graph multiple Y axes(more than 2) stacked one over the other with a common X axis? See attached figure. Each zero in y direction represents the beginning of new y axis.
0
votes
1answer
281 views

Pgfplots with gnuplot - list of coordinates, not file

I want to do a simple graph, where its points will be assigned by a list (NOT a file) of coordinates. So, I know, that I can do something like this: \addplot gnuplot [raw gnuplot, color=blue]{plot "...
0
votes
3answers
1k views

How to do a chart with stacked bars, lines and “sections”

The problem I need a chart like this (this was made in Libreoffice + some gimp): Its caracteristics are bassically: Some stacked bars (if it is a stacked area, better) with its Y axis at the left. ...
49
votes
2answers
5k views

Draw polarized light

I was trying to draw something like that Searching through the net to see if it already exists in tikz I came accross in texample.net the following image which looks a lot like what I want to draw. ...
23
votes
3answers
5k views

How can I make plots with TikZ which look like the new Mathematica 9 plots

The new Mathematica 9 is out! I would love to know how to make similar plots to the one's advertized, particularly the following: and Here is a simple plot to get started. %& -shell-escape \...
10
votes
1answer
189 views

How to typeset maths above the curve of a function with TikZ, with the curve masked (or locally opacified) to improve readibility?

I want to label a family of curves representing a simple family of mathematical functions : x -> x²+c where c will take various values between, say, -6 and 6. I want to superpose the label directly ...
8
votes
1answer
2k views

How to project a function over a 3D plane

When I looked up the method to express two variable functions as a sequence of intersecting horizontal planes, I thought to use PGFplots to construct a simple set of "slices" of a generic function (...
8
votes
2answers
2k views

How to draw this particular Mexican hat potential?

I know there are some other mexican hat questions here, but none of the answers seems complete to me. I would like to draw the following figure with TikZ with similar axis and labeling. How can one do ...
7
votes
1answer
4k views

How to generate stem plots with TikZ like stem() in Matlab?

Given a set of (x,y) coordinates stored in a file, how could I generate a stem plot from those coordinates? I would like to achieve something similar as the matlab's stem function: http://www....
7
votes
5answers
3k views

Tangents to a circle from a point outside of it (tikz)

I'm trying to plot in TikZ the two tangents to a fixed circle passing through a given point. In some details, given an arbitrary circle centered at C with with radius r, and a point P outside of the ...
4
votes
5answers
8k views

How to plot a simple circle in LaTeX

I want to plot one simple circle, but this code is giving me the most grief. Here is what I have written: \begin{figure} \centering \begin{tikzpicture} \pgfplotsset{ticks=none} \begin{axis}[ ...
15
votes
0answers
776 views

Special effects in TikZ leads to unprintable PDF [closed]

So I recently made a picture of the Mexican Hat Potential (related to the Brout-Englert-Higgs Mechanism of particle physics). I am more than satisfied with the graph and everything, but I noticed ...
14
votes
4answers
3k views

Plotting the solution of inequalities with WolframAlpha or Maple

I want to plot the solution of two inequalities and include them in a LaTeX paper. I really like they way this looks: Wolfram Alpha. Unfortunately, I have no idea how to export this into a LaTeX-...
9
votes
1answer
1k views

Huge table/matrix with colored boxes

I have a huge CSV file with about 25.5k records that (structurally) looks like the sample below. In essence, I want to display the values of the columns U,V,W,X,Y,Z of each row as a colored box. The ...
8
votes
3answers
5k views

tikz plot of two sine waves, showing the phase difference

What I am trying to achieve here is to plot two sine waves, and with some dotted lines on the peaks showing a \Delta t in the middle, as the phase difference. Any help appreciated.
8
votes
2answers
519 views

Comparison of pgf plotting packages

I know three ways to do function plots based on the TikZ/pgf package: TikZ/pgf directly pgfplots tkz-fct Which of those options is the most powerful? Why? Can you give typical cases where one ...
6
votes
2answers
284 views

Area Bounded by 4 Curves

I would like to plot the area bounded by the following four curves: x^2 - y^2 = 4 x^2 - y^2 = 1 xy = 1 xy = 2 I'm fond of pstricks but tikz is fine too, whichever is simpler would be best. I tried ...
6
votes
1answer
6k views

Scatterplot with data from CSV file and trendline

I have created a scatterplot with code from this previous asked question. \documentclass[varwidth=true, border=2pt]{standalone} \usepackage[utf8]{inputenc} % this is needed for umlauts \usepackage[...