Graphics, Figures & TablesPgfplots - inserting large font size text

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
jhapk
Posts: 81
Joined: Tue Apr 20, 2010 9:33 pm

Pgfplots - inserting large font size text

Post by jhapk »

Hi,

I have the following code

Code: Select all

\documentclass[12pt]{minimal}
\usepackage{pgfplots}
\usepackage[version=3]{mhchem}

\begin{document}
\begin{tikzpicture}

  \draw (9.3,7.5) node {\textbf{CO}};

  \begin{semilogyaxis}[
      legend pos = south east,
      width=12cm,
      height=10cm,
      xlabel= Y (cm),
      ylabel= \ce{CO},
      xlabel style = {yshift=15pt},
      ylabel style = {yshift=-25pt},
      xmin = -0.5,
      xmax = 0.8,
      ymin = 1e-5,
      ymax = 1,
      xtick= {-0.4,0.6},
      ytick= {1e-4,1},
      enlarge x limits = false,
      table/x expr=(\thisrow{y}-0.025-0.006)*100,
      table/y=cCO]
    \addplot [only marks,mark=square*] table [x expr=\thisrow{Y}] {data.dat};
    \legend {experiment}
  \end{semilogyaxis}

\end{tikzpicture}
\end{document}

It gives me the following result
plot.png
plot.png (7.47 KiB) Viewed 9199 times
for the following data set

Code: Select all

Y cCO
0.2605 2.3851e-4
0.2108 6.2624e-4
0.1587 6.0283e-3
0.108 0.0341
0.0574 0.0413
-0.0429 0.0213
-0.0935 0.0109
-0.1417 8.5054e-3
I want to increase the font size of the inserted text "CO", but when I replace \textbf{CO} with \Large{\textbf{CO}}, it gives me error. How should I do it? Is there a way to increase the fontsize of chemical symbols of mhchem package? Also, why is my legend not working right?

Thanks
Last edited by jhapk on Thu Nov 11, 2010 7:13 pm, edited 3 times in total.

Recommended reading 2024:

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

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

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Pgfplots - inserting large font size text

Post by localghost »

In this case the choice of the »minimal« document class is a fault. It doesn't support font sizes. Furthermore you should add the concerned piece of text as an option to the axis environment.

Code: Select all

\begin{axis}[%
  extra description/.code={\node  at  (0.9,0.9) {\Large\bfseries CO};},
  …
]
  …
\end{axis}
Thanks for the nice example. But for some reasons I can't compile it because I get errors when using the »x expr« option with the \thisrow command. Can you tell me which package version you are using? According to the manual of the version on my machine (1.4.1) it should work. But somehow I can't get it doing so.


Thorsten
jhapk
Posts: 81
Joined: Tue Apr 20, 2010 9:33 pm

Re: Pgfplots - inserting large font size text

Post by jhapk »

Looks like I am using an older pgfplots. The sty file in my local texmf directory has the initial lines
\def\pgfplotsversion{1.3.1}
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Pgfplots - inserting large font size text

Post by localghost »

jhapk wrote:Looks like I am using an older pgfplots. The sty file in my local texmf directory has the initial lines
\def\pgfplotsversion{1.3.1}
The manual title contains the package version and the \listfiles command as very first line in the code will list the package with version number in the log file. So you don't need to look into the package file itself.

Nevertheless I'm surprised that code for an older version doesn't work with the current one. I will try some example from the current manual to exclude failures from my side. But my problems should not affect my approach for a solution.
jhapk
Posts: 81
Joined: Tue Apr 20, 2010 9:33 pm

Re: Pgfplots - inserting large font size text

Post by jhapk »

Thorsten,

I am sorry, but the \thisrow line should not be there. The dataset I provided only has a "Y" coloumn and not a "y" column.

My bad!!
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Re: Pgfplots - inserting large font size text

Post by localghost »

Can happen. So, if the problem is generally solved, please mark the topic accordingly. Otherwise tell us what is missing.
jhapk
Posts: 81
Joined: Tue Apr 20, 2010 9:33 pm

Re: Pgfplots - inserting large font size text

Post by jhapk »

My legend is still not working correctly. I am getting empty squares in my legend while the symbols used were filled squares.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Pgfplots - inserting large font size text

Post by localghost »

jhapk wrote:My legend is still not working correctly. I am getting empty squares in my legend while the symbols used were filled squares.
But that's not the subject of this thread. We had that discussion in the other topic. The problem is comprehensible. Did you contact the maintainer as suggested?
jhapk
Posts: 81
Joined: Tue Apr 20, 2010 9:33 pm

Re: Pgfplots - inserting large font size text

Post by jhapk »

No, I didn't. I will do it right away and mark this thread as solved.
Post Reply