Questions tagged [pgfplots]

{pgfplots} is a package for creating 2D and 3D plots of mathematical functions and numerical data, using the PGF graphics framework. For questions about the inbuilt plotting functionality of TikZ/PGF, use {tikz-pgf} instead.

Filter by
Sorted by
Tagged with
0
votes
0answers
9 views

Centering rotated bar chart value

Using the following bar chart one can see that the label isn't really centered over the bar but placed more on the right. How can I center the value? The alignment has to be like that (rotated and ...
0
votes
1answer
37 views

Code for color in histogram

I would like to know the color codes that appear in the following histogram (code + image): \documentclass{article} \usepackage{tikz} \usepackage{pgfplots} \usepackage{pgfplotstable} \begin{document} ...
0
votes
0answers
10 views

PGFPlots multiple plots issue with gnuplot

I am trying to produce multiple plots in one axis but always get error. It is interesting that file builds fine with both plots separately. Min code that does not working: \documentclass{article} \...
0
votes
1answer
61 views

How to normalize dataset in correct way using pgfplots?

I have a large dateset where one column is: 1 1+n ... n I need to draw plot with coordinates from 0 ... 1. How do to it with pgfplots? Need to produce plot with y (second column) from 0 to 1. My ...
0
votes
0answers
18 views

How to change math-font for pgfplot environments to sans, if necessary with luaotfload fallback?

I would like to change my fonts and especially my math fonts only for my graphs to my sans font Segoe UI. Unfortunately, it doesn't work. I tried already the following sugestions: Change math font ...
1
vote
0answers
25 views

Is it true to say the distance between xmin and xmax is always 196 pt in pgfplots? [duplicate]

By using trials and errors I found xmax is 196 pt in pgfplots, for the example below. I have the following questions: How to measure accurately the distance between xmax and xmin in pgfplots? Is this ...
5
votes
2answers
231 views

Is there a fastest way to draw staircase functions with tikz?

I've been working on a graph for a staircase function, but my code is a mess. Is there a way to make it easier to plot this kind of function? \documentclass[border=1 cm]{standalone} \usepackage{tikz} ...
1
vote
1answer
29 views

PGFplots - How to set fill opacity for a colorbar?

I'm having trouble changing the fill opacity parameter for a colorbar when I use a surf graph. It seems that the fill opacity parameter of the colorbar is always (re)set to 1. Surprisingly, if I use a ...
1
vote
1answer
20 views

Simple solution for decreasing width of boxes in boxplot

I want to make the boxes slimmer in my boxplot. I am unable to find a simple solution or relevant option to change it. I have looked into the solution given here, but to no avail: PGFplots and ...
1
vote
0answers
57 views

Recursive definition of the Cantor Staircase

I'm not the first one to try to draw the Cantor staircase, but I would like to understand why my code doesn't work. This is a minimal example : \documentclass{article} \usepackage{pgfplots} \...
2
votes
1answer
35 views

Scaling pgfplot axis with labels at end of axis

I have the following tikzpicture where the axis labels are anchored at the end of the axes. (code is at the bottom) So far so good except that when I want to scale the axes (uncomment the line below),...
0
votes
2answers
33 views

How do I fix this graph so that it hits the x-axis at the right spot like in desmos?

This is what I currently have: \documentclass{article} \usepackage{pgfplots} \pgfplotsset{compat=1.18} \begin{document} \begin{center} \hspace*{\fill} \begin{tikzpicture} \begin{axis}[width=4in,axis ...
2
votes
1answer
40 views

Stacked ybar interval

I am trying to draw 2 bar plots stacked on top of each other. I have successfully been able to plot a single ybar plot as: \documentclass[11pt]{article} ...
2
votes
0answers
48 views

Generate multiple contour fills inside axis environment

I try to create multiple aligned contour plots inside one coordinate system using pgfplots. However pdflatex seems to freeze for multiple executions of the "contour filled" option. I faked ...
1
vote
2answers
59 views

Plotting function in pgfplot

Hello I would like to plot a function that looks like this equation = x^3 -3x^2 + 1 I tried this \begin{center} \begin{tikzpicture} \begin{axis}[ axis lines = left, xlabel = \(x\), ylabel ...
3
votes
1answer
66 views

Legend with marks and loosely dashed

I have a problem with the visibility of the mark denoted by X in my legend, using a loosely dashed line. How I can make it more clear, e.g. by shifting the dashes a little to the right? (so that the ...
1
vote
1answer
34 views

\pgfplotsinvokeforeach Add one to the variable

I am trying to use the variable from a \pgfplotsinvokeforeach as a path name. I want to get both #1 and #1 + 1 for each iteration. I have not been able to get the #1 + 1 to work; it tries to use ...
0
votes
0answers
29 views

Add vertical lines from ymin to ymax [duplicate]

I am trying to add vertical lines to my plot. The problem is that I don't know what ymax is, so I cannot just draw them easily. So far I have been able to: But I don't know how to shift the top ...
0
votes
1answer
43 views

Fixing histogram drawn using pgfplots [duplicate]

I need to fix my histogram by: Setting the x coords vertically so that the text will be readable without pushing each other. Removing the exponential notations. Also I'm not getting why the vertical ...
0
votes
1answer
33 views

pgfplots bar chart enlarge axis [duplicate]

I would like to create a bar chart using tikz. I want it to look like that: but when I added the data, I got something like that: Is there a way to enlarge the x-axis over the textwidth or some ...
0
votes
1answer
57 views

Plotting a basic function in latex

How can I plot a function in latex?for example, if I simply want to draw a decreasing function in first quadrant say f(x) = 1/x and draw dashed line to join (2,0) to (2,1/2) and solid line to join (2,...
3
votes
3answers
140 views

pgfplots: Dimension too large with no obvious large numbers

The following MWE results in the error Dimension too large. Changing the upper limit of the domain to a smaller value like 120 gets makes this error disappear. \documentclass{article} \usepackage{...
0
votes
0answers
20 views

Help with drawing a normal function on an histogram [duplicate]

How can i make something similar to the photo? Here is the code i used for the histogram: \begin{tikzpicture}[scale=0.80] \begin{axis}[ybar interval, ymax=0.3,ymin=0, axis x line*=bottom, axis y line*...
4
votes
1answer
167 views

Van-der-Waals equation in tikz

I am trying to plot a graph for the Van-der-Waals equation $P=\frac{RT}{V-b}-\frac{a}{V^2} with fixed constants R, T, a, b but definitely there's smth I'm doing wrong. This is my MWE: \documentclass[...
2
votes
1answer
50 views

Create a pgfplots chart with two histograms in same plot

Is it possible to create a plot with pgfplots with the histogram of two variables in the same chart, with a different color each? This an example code I am using, but it creates a histogram where bars ...
0
votes
0answers
25 views

How to customize colorbar in pgfplots [closed]

Recently I am faced with a problem on customizing colorbar in pgfplots. The figure shows my current situation (which is not my expectation). What I want to do is to customize the color of the colorbar....
0
votes
1answer
65 views

Get y value of linear regression plot at xmax

I'm creating a dynamic LaTeX (LuaLaTeX) script, which is creating a plot out of a given CSV file. Settings like xmin, xmax etc. depend on that CSV file. That CSV file contains the storage utilization ...
1
vote
2answers
70 views

Plot graph for cut-off

How can I plot a function like this with LaTeX? But without being pointy (i.e. a smooth transition) and the function never reaching zero? Here is my code: \begin{figure}[H] \centering \begin{...
0
votes
0answers
63 views

Manual of tikzmath

I am a strong user of tikzmath to implement several things in the numeric calculus. However, I miss of a complete manual of tikzmath (separate of tikz), where I can to find all its features, functions,...
0
votes
1answer
41 views

pgfplot tick label in two lines

In my MWE, I want the tick-label "Upper Middle" to appear across two line such that Upper is in the first line and Middle in the next line. \documentclass[a4paper, 12pt]{article} \usepackage[...
1
vote
1answer
27 views

pgfplots - plot a "flat" csv list of y-coordinates

Are there key-value args that would allow me to plot a "flat" csv list of y-values in an axis? I'd rather not set a table then transpose it. eg: \addplot table[header=false,x expr=\...
2
votes
1answer
35 views

Automatic text wrapping in Tikz bar charts?

I am trying to get multiple bar charts (4 per page) in a LaTeX document. The issue is with the title and label text of some charts. It's showing results of a survey, some questions had long text and ...
1
vote
1answer
36 views

Hiding 0 values from nodes within a bar graph

Is it possible to hide the 0 values from appearing when I have node near coords active? even better if I could hide the bar graphs for those specific 0 values. I tried using nodes near coords=y ...
1
vote
1answer
50 views

Why does setting the /pgfplots/variable key interfere with the /tikz/variable key?

I need to set /pfgplots/variable because I have a lot of plots generated using gnuplot in my document. But, when I set /pfgplots/variable={t}, it breaks the plot macro in regular pgf. The MWE \...
4
votes
1answer
40 views

Splitting a graph legend into two legends

Im trying to split a single long legend into two legends. However, the way i did it just filled in the entire line. The is what im trying to achieve: (I think it would be better if those icons were ...
0
votes
0answers
19 views

shader=interp: got unsupported pdf shading type '0' with space between separate groups

I tried to plot a simple 2d-field using pgfplots and octave, following https://tex.stackexchange.com/a/118274/61517. The data can be found here, the corresponding code for my main-file is \...
1
vote
2answers
61 views

latex bar chart values are overlapped. If I rotate, then looks weird

I have bar charts that compare computation time of algorithms. The value above each bar represent the time and because they are bigger than they should be, some values are overlapped to graph or ...
2
votes
1answer
40 views

Adjusting the node labels that are small and not overlapping with each other

Is it possible to make the data labels on the bar graph smaller and not overlapping? \documentclass{article} \usepackage{tikz} \usepackage{pgfplots} \usepackage{siunitx} \pgfplotsset{width=7cm,compat=...
2
votes
1answer
42 views

Remove borders, center a pgfplot both vertically and horizontally and fill the available space

I would like to create a memory card game for my pupils and generate quadratic cards of 6cm width and height which are then embedded in a master file which puts the cards into a grid. A single card ...
3
votes
1answer
103 views

TikZ artifact when graphing (and shading) functions of y

I'm trying to make a simple plot of two functions (of y) and shade the area between them. When I use the shading plot, I get an artifact in the picture. I've tried changing the bounds and splitting ...
1
vote
1answer
34 views

Macro building coordinates breaks \addplot command in pgfplot

I would like create a plot of a few data points that are defined at the top of the document using something like: \newcommand{\test}{{3,4,2,5}} To do this, I created a macro that parses these values ...
0
votes
2answers
38 views

axis lines (spines) of axis offset, and extents to fit last ticks

Consider the image below. There are two properties I would like to replicate with PGFplots Some spines (i.e. axis lines) should be removed (top and right) The spines are pushed outward such that the ...
1
vote
1answer
43 views

Mixing coordinate system for x and y with PGFplots

This question asks how to match coordinate systems in PGFplots from ordered pair to ordered pair. What I would like to do, is mix coordiante systems within an ordered pair, for eaxmple, use axis cs ...
1
vote
1answer
41 views

Fill between smooth vertical lines

I want to fill the area between two curves that are more or less vertical. They go slightly to the side and they are smooth, but the problem is also present when I remove smooth from the \addplot ...
0
votes
0answers
42 views

Is the Solarized color palette available in `LaTeX` or for `pgfplots`?

Is the Solarized color palette available in LaTeX or for pgfplots? Has it been used successfully to improve long-term reading desirability in math books or articles that normally have a white ...
0
votes
1answer
39 views

Creating a sign diagram and adding labels for it on each side of a number line

I am creating a calculus sign diagram by creating a number line and labeling each side of it - the right side with an x and the left side with a y'. Above appropriate intervals I want to add plus and ...
0
votes
1answer
27 views

Removing white space before around tikz subimages

I am trying to place two tikz axes side by side. I currently encapsulate each in a subfigure, but it seems that there are too much white space around the tikz figures that I can barely see the ...
1
vote
3answers
66 views

pgfplots add xtick from array

I have \points array and I want to add xtick and ytick on my axis automatically from it. How can I do that? \documentclass{article} \usepackage{pgfplots} \begin{document} \begin{tikzpicture} \def\...
4
votes
2answers
183 views

How to plot a 3d solid generated by revolving a curve?

I have this curve (0,0) parabola (1,1) and I would like to generate 3d plots where this curve is revolved around the x-axis, y-axis, x=a, y=b, x=c, and y=d. Is this possible? How can I do it? If it's ...
1
vote
1answer
35 views

Pgfplots decimal separator on colorbar for 3D plots

I'm wondering if I can change the number format of the colorbar for a 3D plot. Unfortunately I don't find any answers in the pgfplots manual. Do you have an idea? \begin{tikzpicture} \begin{axis}[ /...

1
2 3 4 5
172