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.

3
votes
1answer
66 views

Epicycle and deferent with Tikz - Function syntax

I want to build an epicyclic graph and found a useful trigonometric function on the web (URL is in comment in my MWE). My personal issue is that I can't write a complex function as a "plot" argument. ...
0
votes
0answers
75 views

plot a data file as a contour plot in a specific region

I have a set of data and want to be plotted in a specific region. I draw the region using tikz and when I want to add the data as a contour plot in the region, I don't get the results. How can I Plot ...
1
vote
2answers
114 views

TiKZ plot x^a* cos(ln(x))

I wanted to plot the function X^(-1.5)*cos(ln(X)) I can do successfully X^(1.5)*cos(ln(X)), but if I put a negative exponent the code does not work. I wanted to plot a function that increases close ...
2
votes
2answers
123 views

Plotting each value for x-axis when plotting from file with TikZ

I want to plot data from file using TikZ, and I successfully do. However, I want to plot every value for the x-axis along the x-axis and remove the comma that appears for each number. My current ...
0
votes
0answers
40 views

The scale of the X-axis bar is far away

I am attempting to create a box plot with very large numbers(using tikzpicture), so I expect their to be smaller numbers on the X-axis but the scale denoted on the graph. THe problem is that scale is ...
5
votes
1answer
144 views

How to generate a xy diagram with multiple grouped data sets?

Based on the answer of Stefan Pinnow in 'How to group several charts into one chart?', I tried to generate a diagram with multiple grouped data. Therefore, I modified the diagram but I have some ...
2
votes
3answers
70 views

Minipage/subfigure issue - creating a set of 4x3 graphs (12 total)

I am trying to fix a 4 by 3 set of graphs, with caption, on a .tex file. The result I want to achieve is the following: (this was done in Word. Yes, that's lame, I know.) The code for each small ...
3
votes
2answers
279 views

Using a data file as input in tikz

I have a sorted data in a file (named data.dat). These data should be plotted vertically. I prepared a code in latex using tikz that works. The problem is each data is typed one by one in the main ...
24
votes
8answers
2k views

What are the benefits of PGFPlots/TikZ compared to importing PDF?

What are the benefits of using tools like pgfplots or tikz directly in LaTeX compared to importing PDF/PGF generated by say matplotlib? This answer believed that the main reason is to match the plots ...
1
vote
1answer
133 views

Drawing of some ellipsoid in tikz

I want to plot some ellipsoids like the following ones in tikz but I don't know how can I do it. How can they be plotted in tikz?
2
votes
2answers
125 views

problem with plotting y=tan(x)

Καλημέρα! I 'm trying to draw the curve y=tan(x). When I draw the curve at the domain (-π/2,π/2) everything is OK (see the 1st code and the image). When I draw the curve at other domains (e.g. (π/2,...
0
votes
1answer
280 views

drawing roc curve analysis

I tried to draw the roc curve with latex but i didn't find any solution. Can any one help please. My code doesn't work and i didn't find a curve like this figure. Could you help me please. Thank you ...
1
vote
1answer
61 views

Adjusting TikZ Figure

I use following script (see also here) below, to draw this figure: \documentclass{article} \usepackage{pgfplots} \usepackage{pgfplotstable} \usepackage{tikz} \usetikzlibrary{positioning} \begin{...
2
votes
1answer
30 views

Graphs using pgfplots: Failure when using x as a negative power

I'm trying to plot the decharging curve of a capacitor. The code is as follows: \documentclass{article} \usepackage{pgfplots} \begin{document} \begin{tikzpicture} \begin{...
4
votes
2answers
639 views

How can I create this graphic?

The picture shows a normal linear regression. Although it is easy to compute on paper, I have no idea how to code a linear regression in order to get an output shown as in the picture. I would be ...
5
votes
5answers
525 views

Plotting exponential functions

Can anyone give me a clue on how to plot this function: It can be with any package, as the ones I've tried to use don't work (pgfplots gives me TeX capacity exceeded, sorry), my attempts with other ...
1
vote
1answer
102 views

Scaling the x-Axis in a more logarithmic way

While I have found some answers for equidistant scaling, I did not find an answer which I was able to transfer directly to my problem. I have one interval going from 10^-8 to 3*10^-8 , one from 3*10^-...
44
votes
3answers
60k views

How to plot data from a CSV file using tikz and csvsimple?

Here is a minimal example : \begin{filecontents*}{data.csv} a,b,c,d 1,4,5,1 2,3,1,5 3,5,6,1 4,1,4,9 5,3,4,7 \end{filecontents*} \documentclass{article} \usepackage[utf8]{inputenc} \usepackage{...
2
votes
0answers
111 views

Plotting errors bars with “plot” without using axis environment from pgfplots

In the axis environment of the pgfplots package there is a simple way to add error bars: \documentclass{minimal} \usepackage{filecontents,pgfplots,tikz} \usetikzlibrary{plotmarks} \begin{...
5
votes
3answers
883 views

Help! How to draw the plot of y=(ax+b)/(cx+d) and give an example!

I find in pst-plot.pdf, pst-func.pdf document but there is no its tutorial. So I hope anyone help me to draw the plot of it.(its code :-)) ). Thanks. Example: y=(x-2)/(2x+1) Can anyone draw it by ...
0
votes
1answer
27 views

Specifying the proper xticks label distance

I have a Tikz plot which looks (roughly) as follows: \documentclass[12pt]{article} \usepackage{amsmath} \usepackage{graphicx} \usepackage{hyperref} \usepackage[latin1]{inputenc} \usepackage{tikz} \...
6
votes
1answer
3k views

Plotting a piecewise function

I'm trying to learn to plot in latex, but I'm having a problem trying to find out which packages that are best to use in this situation, and I find it a bit of a learning curve. Suppose you have the ...
4
votes
2answers
412 views

How to plot diagram like a “#” in tikz

I don't know how to plot diagram like a "#", anyone could give some tips? Thank you!
2
votes
2answers
123 views

Graphing sqrt function: not coming out properly

I have been looking at other posts and have modified my code accordingly, but I still can't get it to work. I think there is an issue that has not been addressed in any of the posts that I have found. ...
0
votes
1answer
26 views

How do I place legend keys above bars/next to lines in Tikz?

I want to follow best practices in plotting graphics using Tikz (see here http://www.eugenewei.com/blog/2017/11/13/remove-the-legend). I'd like to 'remove the legend to become one': instead of ...
34
votes
3answers
91k views

How do I stack two figures on top of each other, rather than side to side?

I'd like my figures to be one on top of the other, rather than next to each other, so that they are larger and spread along the page width. How do I do this? Here is my code: \begin{figure}[H] \...
0
votes
2answers
160 views

Draw a gray box with nodes

I am a new user to tikzplot. Does anyone know how to make the grey box with the nodes inside the box. Thanks
0
votes
2answers
484 views

Plot better graph using a vector of data X and Y

I tried to plot my data using some packages but I didn't get something nice. I've data like this: X=[590 598 599 600 601 602 603 604 605 606 607 608 609 610 611 627 628 629 634 641 642 644 645 648 ...
17
votes
2answers
12k views

How can I import and scale matplotlib plots, keeping fonts the correct size?

I'm working on several pieces of coursework involving lots of plots generated with matplotlib in python scripts. Currently I'm doing this with an iterative process where I set a plot size in the ...
2
votes
1answer
197 views

Drawing Line Plot with uncertainty

Does anyone have an idea how to generate a graph with the 'uncertainty' area like in the picture shown: i have no idea where to start! Thanks for any inspiration! Cheers! Martin
0
votes
1answer
29 views

Plotting an elliptical arc in TikZ with minimal additional packages and as simple as possible functions

I have the above output from Mathematica that I would like to reproduce exactly in LaTeX, but I am just beginning with TikZ and do not understand the huge layers of code that are presented in other ...
15
votes
6answers
14k views

How to plot x^(1/3)?

I tried to export my Geogebra graphs into tikz-code. In General it works fine, but plot x^1/3 doesn't work: \documentclass[10pt]{article} \usepackage{pgf,tikz} \usetikzlibrary{arrows} \pagestyle{...
1
vote
1answer
43 views

How to define vertical line correctly in axis environment?

I Would like to have three vertical dottetd lines from top to bottom to visibly divide the 4 functions. How can I do this. \documentclass[letter,12pt,twoside]{article} \usepackage{tikz} \...
2
votes
3answers
884 views

Best plotting software with latex integration

I'm wondering if there is a software that can create plots with latex integration like gnuplot. I have used gnuplot to create very nice 2D plots with epslatex terminal and I find it superb, but ...
0
votes
2answers
404 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 ...
1
vote
1answer
106 views

Plotting logarithm with base b in TikZ

\begin{tikzpicture}[line cap=round,,x=1.3cm,y=0.4cm] \clip(-1,-3) rectangle (12,13); \draw [domain=0.1:10 ,smooth,very thick] plot(\x, \Log{2}{3*\x}); \draw[->,color=black,line width = 0.8pt] (0,0....
2
votes
1answer
54 views

How do I draw these two lines on a X,Y graph?

I don't really know much about drawing graphs on LaTex so I am kind of lost here. One of the lines is y=-3 (a horizontal line at y=-3) and the other is y=x-3. I have as follows: \documentclass[]{...
1
vote
1answer
39 views

Pgfplots - Turn off Box when plotting a File

By default, pgfplots will draw a box around my plot. I am plotting a .dat-File with \draw table [...] {data.dat} and i want to turn that box off and just leave the x- and y-lines instead. In the ...
1
vote
1answer
67 views

Connecting two functions in a plot

I'm trying to draw two horizontal lines, y = 0 and y = 1, in [0, 1], in front of the already existing plot. The intended result is: The current result is: Obtained from: \documentclass[border=5pt]{...
1
vote
1answer
50 views

Strange asymmetry when plotting identical exponents?

Instead of the expected symmetric shape: what I get from this code: \documentclass[border=5pt]{standalone} \usepackage{pgfplots} \begin{document} \newcommand{\vandbarrierdel}[1]{ \node ...
2
votes
1answer
644 views

Use pgfplots to plot a single column .txt file [duplicate]

I have a single column .txt file with the following info in it 1 2 3 4 5 I use the following ME and it does no work: \documentclass[border=1]{article} \usepackage{pgfplots} \pgfplotsset{compat=1.5}...
1
vote
2answers
124 views

How do I label the axis of a sinus using pi? [duplicate]

I am plotting a sinus function using a pgfplot and would like that the tick of the x axis was labeled using multiplers of pi (pi/4, pi/2, 2*pi...), for they are the "important" x values to visualize ...
5
votes
2answers
424 views

Visualize volume of revolution between two graphs with pgfplots

I am trying to visualize the volume generated by rotating two graphs around the xaxis. For example for the functions f(x) = x^3 + 1 and g(x) = x + 1 (over the interval [0,1]). Here is what I tried so ...
2
votes
1answer
201 views

Help with economics graph

I am new to LaTeX, but I need to draw this 2 period model. Thank you in advance!
4
votes
2answers
118 views

Stacked ybar plot creates additional empty y-entries

I have this code: \documentclass{scrartcl} \usepackage{pgfplots} \pgfplotsset{ compat=1.16, table/col sep=comma} \usepackage{filecontents} \begin{filecontents*}{data.csv} Type, fillA, fillC, ...
1
vote
2answers
85 views

How to use intersections in PGFplots as x-ticks?

I am pretty new to PGFplots, but I am already loving it very much! I want to have a plot, where the intersection of two curves or when the data reaches a certain y-value is labeled on the x-axis as ...
5
votes
1answer
588 views

Plotting the Lorentz Constant in LaTeX

I'm having trouble producing a graph of the Lorentz constant, defined by \frac{1}{\sqrt{1 - v^2/c^2}$ as a function of $v$. (Here, $c$ = $3 * 10^8$). I tried many examples, but I usually get "...
5
votes
2answers
81 views

tabular with xticks enabled at some plots make one plot moved

I have 4 plots arranged using tabular: \documentclass{scrartcl} \usepackage{pgfplots} \pgfplotsset{compat=1.16} \begin{document} \pgfplotsset{ height=4cm, width=\linewidth*0.5, every axis plot ...
1
vote
0answers
53 views

Placing numbers at the above and right side of the plot frame

I have the following code for a plot. I need to place numbers of x-axis and y-axis in above and the right side of the plot frame respectively. The code is \documentclass{standalone} \usepackage{tikz,...
3
votes
1answer
212 views

Fill the area included between two gnuplot contours

this is my first experience with latex plots. I want to fill the small area included between the two contour lines just like i did for the two polynomials, but i think there is some issue with the ...