Graphics, Figures & TablesTikZ Image X-Axis Ticks Issue

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
maltieca
Posts: 4
Joined: Sun Aug 15, 2021 5:58 pm

TikZ Image X-Axis Ticks Issue

Post by maltieca »

Hi Everyone!

I've been trying to figure out how to arrange an issue I am having with one of my plots. I am using Overleaf to carry out my Master's dissertation and I have plotted a graph with Tikz of a parameter x over time. Since the time scale reaches 300,000 seconds, the x-axis of the graph is automatically made to show the short version tick marks, shown below:
Graph1.PNG
Graph1.PNG (30.51 KiB) Viewed 9034 times
However, I tried manually putting xtick labels to 0, 5000, 10000, 15000, etc... but the *10^5 is still there (as shown below).

Graph2.PNG
Graph2.PNG (31.72 KiB) Viewed 9034 times


How can I remove it?



Here is my code:

Code: Select all

\begin{tikzpicture}

\definecolor{color0}{rgb}{1,0,1}

\begin{axis}[
height=8cm,
minor xtick={},
minor ytick={},
tick align=outside,
tick pos=left,
title={S1 Strategy Value Phase-Space Plot for 1 Buyer Trader},
width=15cm,
x grid style={white!69.0196078431373!black},
xmin=-14386.3149981, xmax=302336.6482861,
xtick style={color=black},
xtick={0,50000,100000,150000,200000,250000,300000,350000},
xticklabels={0,50000,100000,150000,200000,250000,300000,350000},
y grid style={white!69.0196078431373!black},
ymin=-1.1, ymax=1.1,
ytick style={color=black},
ytick={-1.25,-1,-0.75,-0.5,-0.25,0,0.25,0.5,0.75,1,1.25},
yticklabels={
  \ensuremath{-}1.25,
  \ensuremath{-}1.00,
  \ensuremath{-}0.75,
  \ensuremath{-}0.50,
  \ensuremath{-}0.25,
  0.00,
  0.25,
  0.50,
  0.75,
  1.00,
  1.25
}
]
Thank you so much.

Recommended reading 2024:

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

NEW: TikZ book now 40% off at Amazon.com for a short time.

Bartman
Posts: 369
Joined: Fri Jan 03, 2020 2:39 pm

TikZ Image X-Axis Ticks Issue

Post by Bartman »

As you can see from reading other topics, it is advisable to offer an Infominimal working example.

The crucial additions in my proposed solution are marked by comments.

Code: Select all

\documentclass{standalone}
\usepackage{pgfplots}

\pgfplotsset{
  compat=1.18,
  /pgf/number format/.cd,% read pgfmanual.pdf for more explanations
    fixed,% crucial addition
    1000 sep={\,},
    min exponent for 1000 sep=4
}

\begin{document}
\begin{tikzpicture}
\begin{axis}[
  height=8cm,
  width=15cm,
  title={S1 Strategy Value Phase-Space Plot for 1 Buyer Trader},
  tick align=outside,
  tick pos=left,
  xmin=-14386.3149981, xmax=302336.6482861,
  scaled x ticks=false,% crucial addition
  xtick={0,5e4,...,35e4},
  ymin=-1.1, ymax=1.1,
  y tick label style={/pgf/number format/zerofill},% crucial addition
  ytick={-1,-0.75,...,1}
]
\end{axis}
\end{tikzpicture}
\end{document}
Post Reply