How to set pgf width dynamically based on template settings

I am using matplotlib and exporting my plots as pfg so I can keep math notation in latex.

I am using elsarticle. Things were working quite well until I switched the template to two columns. In this case the plot is too big and goes beyond the column.

This what I have at the moment:

    caption{This is my plot}

how can I set width so it works well in both single and double column?

TeX - LaTeX Asked by Juan Leni on December 29, 2020

1 Answers

One Answer

You can either set the width manually relative to the type width with a simple scale box and adjust according to a prefered size

    scalebox{0.15typewidth}{import{./}{example.pgf}} label{fig:myplot2}
This is simple answer (scale box width manually)
     caption{This is my plot TWO}

OR set it relative to self adjust to column width

begin{figure}[htb] % loading oversise as 98% of column width
resizebox{0.98columnwidth}{!}{input{example.pgf}} label{fig:myplot3} 
This is better answer (resize box width automagically to suit column)
     caption{This is my plot THREE}
end {figure}  

enter image description here

Answered by user170109 on December 29, 2020

Add your own answers!

Related Questions

the correct order Acronyms

1  Asked on May 5, 2021 by hussein


Compilation error in LuaTeX, but in runs in Lua

1  Asked on May 5, 2021 by hennich


Margin setting for chapter title and chapter number

1  Asked on May 5, 2021 by user3089201


nodal analysis example

2  Asked on May 5, 2021 by gisaa


Alignment in latex

2  Asked on May 5, 2021 by rmp


Is there a fix for this LaTeX rendering artefact?

1  Asked on May 4, 2021 by georgina-davenport


Ask a Question

Get help from others!

© 2022 All rights reserved.